3.3.1 fails to build YJIT with Homebrew LLVM 18
ryansdwilson opened this issue · 7 comments
Discussed in #2371
3.3.1 fails to build on Mac OS
Originally posted by stadia April 25, 2024
macOS Sonoma 14.4.1
while build it 3.3.1, errors happened in Rust YJIT section
building Rust YJIT (release mode)
dyld[30190]: Symbol not found: __ZN4llvm10PGOOptionsC1ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES7_S7_S7_NS_18IntrusiveRefCntPtrINS_3vfs10FileSystemEEENS0_9PGOActionENS0_11CSPGOActionEbb
Referenced from: <EEB49284-2EAD-3371-9401-139E8557678B> /opt/homebrew/Cellar/rust/1.77.2_1/lib/librustc_driver-3dc17bded25d4e59.dylib
Expected in: <B0C4597F-D1E6-36D5-83FD-81D0ACE34F6C> /opt/homebrew/Cellar/llvm/18.1.4/lib/libLLVM.dylib
make: *** [yjit/target/release/libyjit.a] Abort trap: 6
make: *** Waiting for unfinished jobs....
external command failed with status 2
```</div>
[ruby-build.20240425093458.4257.log](https://github.com/rbenv/ruby-build/files/15113126/ruby-build.20240425093458.4257.log)
@ryansdwilson How did you manage to fix the issue? (I'm assuming you managed to do so given that you've closed the issue relatively quickly). I'm also getting a yjit/target/release/libyjit.a Abort trap: 6
error.
Brew reinstall rust
thanks @ryansdwilson, I've tried that but didn't seem to solve the problem. I'll keep debugging (and may open another ticket if this one cannot be re-opened)
Reopening this since it still seems to be an issue. brew install rust
results in LLVM 18 being installed, but Ruby (or Rust?) seem to prefer LLVM 17.
I was able to work around this by explicitly running brew install llvm@17
.
Upon further inspection, this looks like it might be a Homebrew bug. The rust
Homebrew formula explicitly depends on llvm@17
, but brew install rust
for me resulted in LLVM 18 being installed but not LLVM 17. According to what I can reconstruct from Homebrew output, Homebrew first installed rust
which was satisfied by LLVM 17 already being installed, but then it allowed the upgrade LLVM 17 → 18, and in the end it deleted LLVM 17 as part of its cleanup process (which should not have happened per rust
formula dependency).
I am not going to report this to the Homebrew project because I cannot reproduce it anymore, i.e. because the bug depends on a certain state of my system that I am now unable to get back to and therefore unable to explain to the Homebrew team.
Thanks @mislav, explicitly installing llvm@17
worked like a charm.
==> Installing ruby-3.3.1...
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew
-> ./configure "--prefix=$HOME/.rbenv/versions/3.3.1" --with-openssl-dir=/opt/homebrew/opt/openssl@3 --enable-shared --with-libyaml-dir=/opt/homebrew/opt/libyaml --with-gmp-dir=/opt/homebrew/opt/gmp --with-ext=openssl,psych,+ --enable-yjit
-> make -j 10
-> make install
==> Installed ruby-3.3.1 to /Users/attila/.rbenv/versions/3.3.1
FYI: rust-lang/cargo#13795 This issue caused by Homebrew's rust/cargo .