postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.89k stars 250 forks source link

Can't use installed truffleruby 23.1.0 with openssl #469

Closed HoneyryderChuck closed 10 months ago

HoneyryderChuck commented 10 months ago

Description

Coming from https://github.com/oracle/truffleruby/issues/3283

> ruby -e "require 'openssl'"

<internal:core> core/kernel.rb:260:in `require': you may need to install the system OpenSSL library libssl - see https://github.com/oracle/truffleruby/blob/master/doc/user/installing-libssl.md (dlopen(/user/.rubies/truffleruby-23.1.0/lib/mri/openssl.bundle, 0x0002): Library not loaded: @rpath/libgraalvm-llvm.1.dylib (RuntimeError)
  Referenced from: <D3AD165B-0AC8-3019-836C-9D3781CEDAA8> /user/.rubies/truffleruby-23.1.0/lib/mri/openssl.bundle
  Reason: tried: '/usr/local/opt/openssl@3/lib/libgraalvm-llvm.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/openssl@3/lib/libgraalvm-llvm.1.dylib' (no such file), '/usr/local/opt/openssl@3/lib/libgraalvm-llvm.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/openssl@3/lib/libgraalvm-llvm.1.dylib' (no such file), '/usr/local/lib/libgraalvm-llvm.1.dylib' (no such file), '/usr/lib/libgraalvm-llvm.1.dylib' (no such file, not in dyld cache))
        from /user/.rubies/truffleruby-23.1.0/lib/mri/openssl.rb:13:in `<top (required)>'
        from <internal:core> core/kernel.rb:260:in `require'
        from -e:1:in `<main>'

In the linked issue, it's mentioned that a certain post install hook isn't run in the process of installing truffleruby, which makes the openssl extension fail to link to libgraalvm.

Environment

$ ruby-install --version
ruby-install: 0.9.2
...
$ uname -a
Darwin MacBook-Pro.lan 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64
$ cc --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ openssl version
openssl version
OpenSSL 1.1.1w  11 Sep 2023
postmodern commented 10 months ago

@HoneyryderChuck just to double check, does this happen after manually installing truffleruby? Is this a problem with ruby-install, or some platform issue with truffleruby?

HoneyryderChuck commented 10 months ago

According to the linked issue, ruby-install is not running a post install hook that it should. Can you confirm?

postmodern commented 10 months ago

@HoneyryderChuck ruby-install definitely runs the post-installation script:

Also, both truffleruby and truffleruby-graalvm has openssl as a dependency:

On Fedora Linux I'm able to load openssl with truffleruby-23.1.0 (haven't tested truffleruby-graalvm).

$ chruby truffleruby-23.1.0
$ ruby -e "require 'openssl'"
postmodern commented 10 months ago

@HoneyryderChuck how did you install truffleruby with ruby-install? ruby-install truffleruby? Also, I assume from the error message that your package manager is Homebrew?

HoneyryderChuck commented 10 months ago

yup, it's homebrew (I'm on Mac OS). I've done ruby-install truffleruby 23.1.0.

eregon commented 10 months ago

The problem seems not in ruby-install but in the macOS or XCode version used, so I think let's close this and continue on https://github.com/oracle/truffleruby/issues/3283