Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh install unable to run gem because dynamic linker can't find llvm lib #3394

Closed
relistan opened this issue Jan 18, 2024 · 5 comments
Closed

Comments

@relistan
Copy link

I did a fresh install with:

macOS Sonoma 14.1

asdf install ruby truffleruby+graalvm-23.1.1

Running gem at any path outside of /Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/ results in:

<internal:core> core/kernel.rb:234:in `gem_original_require': dlopen(/Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/psych.bundle, 0x0002): Library not loaded: @rpath/libgraalvm-llvm.1.dylib (RuntimeError)
  Referenced from: <D7C051E5-2D35-3DB9-91A3-6DA4AA679139> /Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/psych.bundle
  Reason: tried: '/opt/homebrew/opt/libyaml/lib/libgraalvm-llvm.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libyaml/lib/libgraalvm-llvm.1.dylib' (no such file), '/opt/homebrew/opt/libyaml/lib/libgraalvm-llvm.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libyaml/lib/libgraalvm-llvm.1.dylib' (no such file)
	from <internal:/Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/psych.rb:13:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from <internal:/Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/rubygems.rb:608:in `load_yaml'
	from /Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/rubygems/config_file.rb:351:in `load_file'
	from /Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/rubygems/config_file.rb:194:in `initialize'
	from /Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/rubygems/gem_runner.rb:71:in `do_configuration'
	from /Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/rubygems/gem_runner.rb:33:in `run'
	from /Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/bin/gem:29:in `<main>'

The output of otool -L shows:

/Users/my_user/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/psych.bundle:
	@rpath/libgraalvm-llvm.1.dylib (compatibility version 0.0.0, current version 1.0.0)
	/opt/homebrew/opt/libyaml/lib/libyaml-0.2.dylib (compatibility version 3.0.0, current version 3.9.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.61.1)```

Looking at the pysch.bundle it seems to have rpath pointed weirdly:

$ otool -l /Users/kmatthias/.asdf/installs/ruby/truffleruby+graalvm-23.1.1/lib/mri/psych.bundle | grep LC_RPATH -A2
          cmd LC_RPATH
      cmdsize 48
         path /opt/homebrew/opt/libyaml/lib (offset 12)

This means it is unable to find the @rpath/libgraalvm-llvm.1.dylib

I looked at post_install_hook.sh and saw that it will recompile psych under certain circumstances. I ran that part of the post install by hand with this script extract:

root=`pwd`
function recompile() {
  ext="$1"
  cd "src/main/c/$ext"
  truffleruby -w extconf.rb
  if [ -z "$CORES" ]; then
    CORES=$(getconf _NPROCESSORS_ONLN || echo 1)
  fi
  make "--jobs=$CORES"
  cp "$ext.$(truffleruby -rrbconfig -e "print RbConfig::CONFIG['DLEXT']")" "$root/lib/mri"
  cd "$root"
  echo
}

recompile psych

Which I ran from inside the base directory. This recompiled... but the result was the same.

@relistan
Copy link
Author

If this should be opened on asdf-ruby, I'm happy to do that. It's not clear to me where to file this.

@relistan relistan changed the title Frensh install unable to run gem because dynamic linker can't find llvm lib Fresh install unable to run gem because dynamic linker can't find llvm lib Jan 18, 2024
@eregon
Copy link
Member

eregon commented Jan 18, 2024

Could you try 23.1.2 which was just released and has a fix for this macOS-specific issue?
See https://github.com/oracle/truffleruby/releases/tag/graal-23.1.2
That looks like a duplicate of #3283 & #3294.
I'm pretty sure that will fix it so I'll already close, but please comment if that doesn't fix it.

@relistan
Copy link
Author

Could you try 23.1.2 which was just released and has a fix for this macOS-specific issue? See https://github.com/oracle/truffleruby/releases/tag/graal-23.1.2 That looks like a duplicate of #3283 & #3294. I'm pretty sure that will fix it so I'll already close, but please comment if that doesn't fix it.

Ah, thank you. I had read both of those but they seemed slightly different. But now I see what you meant. I will give that a shot with the new release and only comment back if for some reason that does not fix it. Thanks!

@eregon
Copy link
Member

eregon commented Jan 18, 2024

and only comment back if for some reason that does not fix it.

Please let us know if it works too :)
Sorry, it was a bit of a "premature optimization" to already close this issue, my bad.

@relistan
Copy link
Author

and only comment back if for some reason that does not fix it.

Please let us know if it works too :) Sorry, it was a bit of a "premature optimization" to already close this issue, my bad.

All good, I appreciate you replying to the issue.

Anyway, it works! Thanks. Appears that it was a more general Sonoma incompatibility fixed in that release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants