asdf-ruby: Ruby 2.6.5 fails to compile on MacOS Big Sur
After update to Big Sur, the ruby 2.6.5 won’t compile. asdf install ruby 2.6.5
returns the following output:
Downloading openssl-1.1.1g.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
Installing openssl-1.1.1g...
Installed openssl-1.1.1g to /Users/bartoszmaka/.asdf/installs/ruby/2.6.5
Downloading ruby-2.6.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
Installing ruby-2.6.5...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 11.0.1 using ruby-build 20201005)
Inspect or clean up the working tree at /var/folders/q2/0bgpj9917svbst6d9ls2bdfh0000gn/T/ruby-build.20201124095057.44614.wwBG4Q
Results logged to /var/folders/q2/0bgpj9917svbst6d9ls2bdfh0000gn/T/ruby-build.20201124095057.44614.log
Last 10 log lines:
transform_mjit_header: SKIPPED to transform __inline_isinff
transform_mjit_header: SKIPPED to transform __inline_isfinitel
transform_mjit_header: SKIPPED to transform __inline_isfinited
transform_mjit_header: SKIPPED to transform __inline_isfinitef
transform_mjit_header: SKIPPED to transform __darwin_fd_clr
transform_mjit_header: SKIPPED to transform __darwin_fd_set
transform_mjit_header: SKIPPED to transform __darwin_fd_isset
transform_mjit_header: SKIPPED to transform __darwin_check_fd_set
transform_mjit_header: SKIPPED to transform __sputc
ln -sf ../../../.ext/include/x86_64-darwin20/rb_mjit_min_header-2.6.5.h include/ruby-2.6.0/x86_64-darwin20/rb_mjit_min_header-2.6.5.h
Those are last lines from compilation log:
linking miniruby
ld: warning: dylib (/usr/local/lib/libgmp.dylib) was built for newer macOS version (11.0) than being linked (10.15.6)
rb_mjit_header.h updated
generating encdb.h
building .ext/include/x86_64-darwin20/rb_mjit_min_header-2.6.5.h
./miniruby -I./lib -I. -I.ext/common ./tool/transform_mjit_header.rb "clang " rb_mjit_header.h .ext/include/x86_64-darwin20/rb_mjit_min_header-2.6.5.h
encdb.h updated
./tool/ifchange "--timestamp=.rbconfig.time" rbconfig.rb rbconfig.tmp
rbconfig.rb updated
generating enc.mk
creating verconf.h
verconf.h updated
compiling loadpath.c
making srcs under enc
linking static-library libruby.2.6-static.a
make[1]: Nothing to be done for `srcs'.
generating transdb.h
linking shared-library libruby.2.6.dylib
ld: warning: dylib (/usr/local/lib/libgmp.dylib) was built for newer macOS version (11.0) than being linked (10.15.6)
Undefined symbols for architecture x86_64:
"__mh_execute_header", referenced from:
_rb_dump_backtrace_with_lines in addr2line.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libruby.2.6.dylib] Error 1
make: *** Waiting for unfinished jobs....
transdb.h updated
The same issue occurs with ruby 2.7.2, and ruby 2.6.5 installed via rvm
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 15 (1 by maintainers)
I ran into a problem installing ruby 2.6.6 (not 2.6.5) on Big Sur / 2020 MacBook Air (M1 / apple silicon). I tried every which way with openssl to no avail.
Found this comment in
ruby-build
issues:Here’s what I did:
(fish shell version)
if that doesn’t work, let me know --I tried a bunch of things before I got there
@edmangimelli you’re the best. That was helpful. Who keeps notes like that?? Attempting to good citizen in response… I’m circling back here to note what worked for me.
I did not set all those flags this time around but I did try that earlier before all the
readline
andopenssl
business… so perhaps that is still necessary? I use ZSH shell but foolishly typed it all in using the fish syntax… anyhow?@rpdecks
sorry, these notes are a little rough:
installing asdf
installing coreutils
(a dependency of asdf) (i already have curl and git)
installing asdf
can’t remember where this came from:
adding to .asdfrc
installing Ruby 2.6.6 with asdf (FAILED)
installing Ruby 3.0.0 with asdf (SUCCESS)
installing Ruby 2.7.2 with asdf (HANGS)
installing Ruby 2.7.1 with asdf (FAILED)
trying a comment from rbenv issues (FAILED)
trying this https://github.com/rbenv/ruby-build/issues/1691#issuecomment-772224551
^^^ also failed
let’s try rbenv instead, first removing
legacy_version_file = yes
from .asdfrcinstalling rbenv
installing Ruby 2.6.6 with rbenv (FAILED)
also failed ^^^
installing Ruby 2.6.6 with asdf - Round 2 (FAILED)
following this: https://github.com/rbenv/ruby-build/issues/1691#issuecomment-751936989
installed xcode command line tools Command_Line_Tools_for_Xcode_12.5_beta_2.dmg
^^ failed
installing Ruby 2.6.6 with asdf - Round 3 (SUCCESS!!!)
from https://github.com/rbenv/ruby-build/issues/1699#issuecomment-762122911
export optflags="-Wno-error=implicit-function-declaration"; export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"; export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"; export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"
converted to fish:
adding to .asdfrc
This solution didn’t work on
macOS 12.6
+ruby-build 20221004
I’m not seeing this exact error, but I had a similar chain of issues (Ruby wouldn’t install; fixed by overriding library path but then FFI didn’t work). What worked for me is
bundle config build.ffi --disable-system-libffi
thenbundle update ffi
. You might need togem uninstall ffi
first.ヘ( ^o^)ノ\(^_^ )
Currently, the asdf-ruby plugin references an old ruby-build tag (which uses an old openssl version; we need openssl-111i https://github.com/rbenv/ruby-build/commit/bad7a7c0b4833f44cf653e7107f0e19e209bfe2e). I had to manually update the tag to be able to install Ruby on Apple M1:
With that, installing Ruby should work now: