rbenv / ruby-build

A tool to download, compile, and install Ruby on Unix-like systems.
https://rbenv.org/man/ruby-build.1
MIT License
3.89k stars 785 forks source link

Issues with installing ruby 3.3.4 on mac #2425

Closed adelmoradian closed 3 months ago

adelmoradian commented 4 months ago

I have issues with building ruby 3.3.4 on my mac.

macOS 14.5 on x86_64 using ruby-build 20240709.1

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

The output of rbenv install 3.3.4 ends with:

building spec/ruby/optional/capi/ext/array_spec.bundle
building spec/ruby/optional/capi/ext/basic_object_spec.bundle
building spec/ruby/optional/capi/ext/bignum_spec.bundle
building spec/ruby/optional/capi/ext/binding_spec.bundle
building spec/ruby/optional/capi/ext/boolean_spec.bundle
building spec/ruby/optional/capi/ext/class_id_under_autoload_spec.bundle
building spec/ruby/optional/capi/ext/class_spec.bundle
building spec/ruby/optional/capi/ext/class_under_autoload_spec.bundle
building spec/ruby/optional/capi/ext/complex_spec.bundle
building spec/ruby/optional/capi/ext/constants_spec.bundle
building spec/ruby/optional/capi/ext/data_spec.bundle
building spec/ruby/optional/capi/ext/debug_spec.bundle
building spec/ruby/optional/capi/ext/encoding_spec.bundle
building spec/ruby/optional/capi/ext/enumerator_spec.bundle
building spec/ruby/optional/capi/ext/exception_spec.bundle
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
make: *** [spec/ruby/optional/capi/ext/class_id_under_autoload_spec.bundle] Error 1
make: *** Waiting for unfinished jobs....
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/class_under_autoload_spec.bundle] Error 1
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/binding_spec.bundle] Error 1
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/basic_object_spec.bundle] Error 1
make: *** [spec/ruby/optional/capi/ext/boolean_spec.bundle] Error 1
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/complex_spec.bundle] Error 1
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/exception_spec.bundle] Error 1
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/enumerator_spec.bundle] Error 1
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/bignum_spec.bundle] Error 1
make: *** [spec/ruby/optional/capi/ext/debug_spec.bundle] Error 1
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
make: *** [spec/ruby/optional/capi/ext/data_spec.bundle] Error 1
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ext/configure-ext.mk updated
make: *** [spec/ruby/optional/capi/ext/class_spec.bundle] Error 1
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/constants_spec.bundle] Error 1
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/array_spec.bundle] Error 1
ld: load command rbenv/rbenv#12 string extends beyond end of load command in '/private/var/folders/rm/q_qggcdx7mq2th4szwlxsn7h0000gp/T/ruby-build.20240710105929.70239.UqziPS/ruby-3.3.4/libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/encoding_spec.bundle] Error 1
external command failed with status 2
mislav commented 4 months ago

Hi, do you have binutils installed from Homebrew, and can you temporarily unlink it?

brew unlink binutils
adelmoradian commented 4 months ago

Hi! Yes I do have binutils 2.42 already installed with Homebrew however unlinking didn't help. I tried also just downloading ruby and building it from source however it did not work either... I noticed that this is also happening with other ruby versions now.

mislav commented 4 months ago

I have never seen this reported before, but I would guess that something is broken with the build system on your machine, e.g. that some non-standard tools were installed into PATH, or that some build-related environment variables are mis-configured (see the output of env). You could also try completely reinstalling Xcode command-line tools. Additionally, if you are a Python developer/data scientist and you have Anaconda suite of tools installed, you can try temporarily uninstalling or unlinking them because that's also known to break Ruby compilation.

seabre commented 3 months ago

I ran into this problem today, and it hadn't been a problem before, where anaconda was overriding my nm installation and it breaking the build. Uninstalling anaconda solved it.

Basically I just went through the build log, saw which command was failing (nm) and checked to see which one was being used via which nm.

mislav commented 3 months ago

Thanks for chiming in, @seabre!

Closing the issue since I don't believe this is a bug with ruby-build nor is it something that our project can solve.