commonmarker: Dependency error on new M1 Mac

I’m trying to build my Github Pages website locally on my M1 mac Mini using this guide. However, whenever I execute bundle exec jekyll serve, I get the following error:

  Dependency Error: Yikes! It looks like you don't have jekyll-commonmark-ghpages or one of its dependencies installed. In 
order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 
'dlopen(/Users/venkat/Sites/venkatasg.github.io/vendor/bundle/ruby/2.6.0/gems/commonmarker-
0.17.13/lib/commonmarker/commonmarker.bundle, 0x0009): missing compatible arch in 
/Users/venkat/Sites/venkatasg.github.io/vendor/bundle/ruby/2.6.0/gems/commonmarker-
0.17.13/lib/commonmarker/commonmarker.bundle - 
/Users/venkat/Sites/venkatasg.github.io/vendor/bundle/ruby/2.6.0/gems/commonmarker-
0.17.13/lib/commonmarker/commonmarker.bundle' If you run into trouble, you can find helpful resources at 
https://jekyllrb.com/help/!
jekyll 3.8.7 | Error:  jekyll-commonmark-ghpages

I can’t seem to find any help regarding this dependency error - I suspect this has something to do with the new arm64 architecture of the M1 Macs, since the error says missing compatible arch. Any help would be appreciated.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 15 (3 by maintainers)

Most upvoted comments

@kivikakk On your M1 Mac, can you confirm that running the tutorial I linked command-by-command to create a new template repository works without a hitch? I still keep getting this error after a lot of messing around, which seems to point towards an issue with jekyll.

Yes, the log attached to my last comment was the end of running through the tutorial commands exactly, and culminated in jekyll successfully serving requests.

From your logs:

bundler: failed to load command: jekyll (/Users/venkat/.gem/ruby/2.6.0/bin/jekyll)
LoadError: dlopen(/Users/venkat/.gem/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Users/venkat/.gem/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle - /Users/venkat/.gem/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle

It looks as if the gems are installed in your home directory’s .gem directory, and not vendor nor /Library. If I were in your position right now I’d be trying this in the tutorial project dir:

rm -rf vendor .bundle
bundle config set --local path 'vendor/bundle'
bundle install

Then, verify that the native extensions are all arm64:

find vendor -name \*.bundle -exec file '{}' \;

Here’s me doing this now:

$ pwd
/Users/kameliya/Code/scratch/jekyll
$ ls
404.html        Gemfile         Gemfile.lock    _config.yml     _posts/         _site/          about.markdown  index.markdown  vendor/
$ rm -rf vendor .bundle
$ bundle config set --local path 'vendor/bundle'
$ bundle install
The dependency tzinfo (~> 1.2) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32 java`.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32 java`.
The dependency wdm (~> 0.1.1) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/.........
Fetching public_suffix 4.0.6
Installing public_suffix 4.0.6
Fetching addressable 2.7.0
Installing addressable 2.7.0
Using bundler 2.1.4
Fetching colorator 1.1.0
Installing colorator 1.1.0
Fetching concurrent-ruby 1.1.7
Installing concurrent-ruby 1.1.7
Fetching eventmachine 1.2.7
Installing eventmachine 1.2.7 with native extensions
Fetching http_parser.rb 0.6.0
Installing http_parser.rb 0.6.0 with native extensions
Fetching em-websocket 0.5.2
Installing em-websocket 0.5.2
Fetching ffi 1.14.2
Installing ffi 1.14.2 with native extensions
Fetching forwardable-extended 2.6.0
Installing forwardable-extended 2.6.0
Fetching i18n 1.8.5
Installing i18n 1.8.5
Fetching sassc 2.4.0
Installing sassc 2.4.0 with native extensions
Fetching jekyll-sass-converter 2.1.0
Installing jekyll-sass-converter 2.1.0
Fetching rb-fsevent 0.10.4
Installing rb-fsevent 0.10.4
Fetching rb-inotify 0.10.1
Installing rb-inotify 0.10.1
Fetching listen 3.3.3
Installing listen 3.3.3
Fetching jekyll-watch 2.2.1
Installing jekyll-watch 2.2.1
Fetching rexml 3.2.4
Installing rexml 3.2.4
Fetching kramdown 2.3.0
Installing kramdown 2.3.0
Fetching kramdown-parser-gfm 1.1.0
Installing kramdown-parser-gfm 1.1.0
Fetching liquid 4.0.3
Installing liquid 4.0.3
Fetching mercenary 0.4.0
Installing mercenary 0.4.0
Fetching pathutil 0.16.2
Installing pathutil 0.16.2
Fetching rouge 3.26.0
Installing rouge 3.26.0
Fetching safe_yaml 1.0.5
Installing safe_yaml 1.0.5
Fetching unicode-display_width 1.7.0
Installing unicode-display_width 1.7.0
Fetching terminal-table 2.0.0
Installing terminal-table 2.0.0
Fetching jekyll 4.2.0
Installing jekyll 4.2.0
Fetching jekyll-feed 0.15.1
Installing jekyll-feed 0.15.1
Fetching jekyll-seo-tag 2.7.1
Installing jekyll-seo-tag 2.7.1
Fetching minima 2.5.1
Installing minima 2.5.1
Bundle complete! 6 Gemfile dependencies, 31 gems now installed.
Gems in the group benchmark were not installed.
Bundled gems are installed into `./vendor/bundle`
Post-install message from i18n:

HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.

If you are upgrading your Rails application from an older version of Rails:

Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.

If you are starting a NEW Rails application, you can ignore this notice.

For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0

$ find vendor -name \*.bundle -exec file '{}' \; | sed 's_vendor/bundle/ruby/2..../__'
extensions/arm64-darwin-20/2.7.0/sassc-2.4.0/sassc/libsass.bundle: Mach-O 64-bit bundle arm64
extensions/arm64-darwin-20/2.7.0/ffi-1.14.2/ffi_c.bundle: Mach-O 64-bit bundle arm64
extensions/arm64-darwin-20/2.7.0/http_parser.rb-0.6.0/ruby_http_parser.bundle: Mach-O 64-bit bundle arm64
extensions/arm64-darwin-20/2.7.0/eventmachine-1.2.7/fastfilereaderext.bundle: Mach-O 64-bit bundle arm64
extensions/arm64-darwin-20/2.7.0/eventmachine-1.2.7/rubyeventmachine.bundle: Mach-O 64-bit bundle arm64
gems/sassc-2.4.0/ext/libsass.bundle: Mach-O 64-bit bundle arm64
gems/sassc-2.4.0/lib/sassc/libsass.bundle: Mach-O 64-bit bundle arm64
gems/ffi-1.14.2/ext/ffi_c/ffi_c.bundle: Mach-O 64-bit bundle arm64
gems/ffi-1.14.2/lib/ffi_c.bundle: Mach-O 64-bit bundle arm64
gems/http_parser.rb-0.6.0/ext/ruby_http_parser/ruby_http_parser.bundle: Mach-O 64-bit bundle arm64
gems/http_parser.rb-0.6.0/lib/ruby_http_parser.bundle: Mach-O 64-bit bundle arm64
gems/eventmachine-1.2.7/ext/fastfilereader/fastfilereaderext.bundle: Mach-O 64-bit bundle arm64
gems/eventmachine-1.2.7/ext/rubyeventmachine.bundle: Mach-O 64-bit bundle arm64
gems/eventmachine-1.2.7/lib/fastfilereaderext.bundle: Mach-O 64-bit bundle arm64
gems/eventmachine-1.2.7/lib/rubyeventmachine.bundle: Mach-O 64-bit bundle arm64
$ bundle exec jekyll serve
Configuration file: /Users/kameliya/Code/scratch/jekyll/_config.yml
            Source: /Users/kameliya/Code/scratch/jekyll
       Destination: /Users/kameliya/Code/scratch/jekyll/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
       Jekyll Feed: Generating feed for posts
                    done in 0.152 seconds.
 Auto-regeneration: enabled for '/Users/kameliya/Code/scratch/jekyll'
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

Hope this helps.

I’d also like to just quickly point out that this project is run entirely by volunteers, and the ask of getting it working “as it always has” on brand new architecture should be taken with the added context that we’re just now beginning to come out of a very difficult year for many people. Getting Commonmark to turn into HTML is, for me personally, not the highest on my list of priorities at this moment.

It sounds like @kivikakk provided a solution, and if or when CI supports the new architecture I’m sure this project and others will be able to test for it.

Until then let’s provide any suggestions and insights we all can.

I’m posting this for anyone else who may come across this issue. As @sanzaru pointed out in this issue thread the problem is in jekyll and ffi. The workaround for now is to install jekyll and gems using the x86_64 ruby and bundle commands. Prefix any bundle commands with x86_64 and everything works fine. Hopefully arm64 support will come soon.

@kivikakk Interesting that you get only the arm64 gems installed locally, I have both arm64 and x86_64 binaries installed. In any case, I tried what you suggested, and I’m still getting errors running jekyll even when it is installed locally. Log is attached below. although I suspect I could find the answer in one of the ffi issues opened in the last two weeks related to M1 Macs.

Happy New Year!

~/Sites  $ mkdir jek
~/Sites  $ cd jek
~/S/jek  $ bundle init
Writing new Gemfile to /Users/venkat/Sites/jek/Gemfile
~/S/jek  $ bundle config set --local path 'vendor/bundle'
~/S/jek  $ bundle install
The Gemfile specifies no dependencies
Resolving dependencies...
Bundle complete! 0 Gemfile dependencies, 1 gem now installed.
Bundled gems are installed into `./vendor/bundle`
~/S/jek  $ bundle add jekyll
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Fetching public_suffix 4.0.6
Installing public_suffix 4.0.6
Fetching addressable 2.7.0
Installing addressable 2.7.0
Using bundler 2.1.4
Fetching colorator 1.1.0
Installing colorator 1.1.0
Fetching concurrent-ruby 1.1.7
Installing concurrent-ruby 1.1.7
Fetching eventmachine 1.2.7
Installing eventmachine 1.2.7 with native extensions
Fetching http_parser.rb 0.6.0
Installing http_parser.rb 0.6.0 with native extensions
Fetching em-websocket 0.5.2
Installing em-websocket 0.5.2
Fetching ffi 1.14.2
Installing ffi 1.14.2 with native extensions
Fetching forwardable-extended 2.6.0
Installing forwardable-extended 2.6.0
Fetching i18n 1.8.5
Installing i18n 1.8.5
Fetching sassc 2.4.0
Installing sassc 2.4.0 with native extensions
Fetching jekyll-sass-converter 2.1.0
Installing jekyll-sass-converter 2.1.0
Fetching rb-fsevent 0.10.4
Installing rb-fsevent 0.10.4
Fetching rb-inotify 0.10.1
Installing rb-inotify 0.10.1
Fetching listen 3.4.0
Installing listen 3.4.0
Fetching jekyll-watch 2.2.1
Installing jekyll-watch 2.2.1
Fetching rexml 3.2.4
Installing rexml 3.2.4
Fetching kramdown 2.3.0
Installing kramdown 2.3.0
Fetching kramdown-parser-gfm 1.1.0
Installing kramdown-parser-gfm 1.1.0
Fetching liquid 4.0.3
Installing liquid 4.0.3
Fetching mercenary 0.4.0
Installing mercenary 0.4.0
Fetching pathutil 0.16.2
Installing pathutil 0.16.2
Fetching rouge 3.26.0
Installing rouge 3.26.0
Fetching safe_yaml 1.0.5
Installing safe_yaml 1.0.5
Fetching unicode-display_width 1.7.0
Installing unicode-display_width 1.7.0
Fetching terminal-table 2.0.0
Installing terminal-table 2.0.0
Fetching jekyll 4.2.0
Installing jekyll 4.2.0
~/S/jek  $ bundle install
Using public_suffix 4.0.6
Using addressable 2.7.0
Using bundler 2.1.4
Using colorator 1.1.0
Using concurrent-ruby 1.1.7
Using eventmachine 1.2.7
Using http_parser.rb 0.6.0
Using em-websocket 0.5.2
Using ffi 1.14.2
Using forwardable-extended 2.6.0
Using i18n 1.8.5
Using sassc 2.4.0
Using jekyll-sass-converter 2.1.0
Using rb-fsevent 0.10.4
Using rb-inotify 0.10.1
Using listen 3.4.0
Using jekyll-watch 2.2.1
Using rexml 3.2.4
Using kramdown 2.3.0
Using kramdown-parser-gfm 1.1.0
Using liquid 4.0.3
Using mercenary 0.4.0
Using pathutil 0.16.2
Using rouge 3.26.0
Using safe_yaml 1.0.5
Using unicode-display_width 1.7.0
Using terminal-table 2.0.0
Using jekyll 4.2.0
Bundle complete! 1 Gemfile dependency, 28 gems now installed.
Bundled gems are installed into `./vendor/bundle`
~/S/jek  $ bundle exec jekyll serve
bundler: failed to load command: jekyll (/Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/bin/jekyll)
LoadError: dlopen(/Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle - /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:6:in `require'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:6:in `rescue in <top (required)>'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:3:in `<top (required)>'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/lib/sassc/native.rb:3:in `require'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/lib/sassc/native.rb:3:in `<top (required)>'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/lib/sassc.rb:31:in `require_relative'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/lib/sassc.rb:31:in `<top (required)>'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/jekyll-sass-converter-2.1.0/lib/jekyll/converters/scss.rb:3:in `require'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/jekyll-sass-converter-2.1.0/lib/jekyll/converters/scss.rb:3:in `<top (required)>'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/jekyll-sass-converter-2.1.0/lib/jekyll-sass-converter.rb:4:in `require'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/jekyll-sass-converter-2.1.0/lib/jekyll-sass-converter.rb:4:in `<top (required)>'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/jekyll-4.2.0/lib/jekyll.rb:195:in `require'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/jekyll-4.2.0/lib/jekyll.rb:195:in `<top (required)>'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/jekyll-4.2.0/exe/jekyll:8:in `require'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/gems/jekyll-4.2.0/exe/jekyll:8:in `<top (required)>'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/bin/jekyll:23:in `load'
  /Users/venkat/Sites/jek/vendor/bundle/ruby/2.6.0/bin/jekyll:23:in `<top (required)>'