Closed monfresh closed 3 years ago
Next, I will try cloning this repo and trying it with ruby-install
version 0.7.0. I wonder if something in 0.8.0 broke.
I ended up uninstalling ruby-install
0.8.0 with brew uninstall ruby-install
. Then I downloaded the zip file of ruby-install 0.7.1 via the releases page in this repo, then from the downloaded ruby-install-0.7.1
folder, I ran bin/ruby-install ruby-2.7.1
and it's working fine. So, I'm pretty sure there is a bug in 0.8.0. It looks like 0.7.1 was properly setting CPPFLAGS
and DLDFLAGS
, but 0.8.0 is not.
Here is the difference:
In 0.8.0:
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -fstack-protector-strong -Wl,-pie -framework Security -framework Foundation
In 0.7.1:
CPPFLAGS = -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -fstack-protector-strong -Wl,-pie -framework Security -framework Foundation
@postmodern
Installing with the --with-openssl-dir
flag seems to do the trick:
ruby-install ruby-2.7.1 -- --with-openssl-dir=$(brew prefix openssl)
Was this an intentional change in 0.8.0? I don't see anything about this in the changelog or in the Readme.
@monfresh it appears that the package manager detection isn't detecting homebrew. I am guessing this is due to uname -s
not being "Darwin".
https://github.com/postmodern/ruby-install/blob/3cb283cb587378f1065bf8de4c8b573a3a111423/share/ruby-install/package_manager.sh#L8-L36
uname -s
shows Darwin
for me.
@postmodern I added some debug statements. The problem is that $os_platform
is nil when it reaches detect_package_manager
. In 0.7.1, detect_package_manager
did not depend on $os_platform
, so it sounds like you perhaps forgot to set $os_platform
so that detect_package_manager
has access to it.
Ha! You are sourcing package_manager
before setting $os_platform
:) Moving the source line to after the variable assignments fixes the problem.
Found the culprit! package_manager.sh
was being loaded before os_platform
was being set... 0.8.1 will be released soon.
https://github.com/postmodern/ruby-install/blob/3cb283cb587378f1065bf8de4c8b573a3a111423/share/ruby-install/package_manager.sh#L8-L36
Yep. I came to that same conclusion. See my previous comment 👍
0.8.1 has been released.
Awesome. Thanks!
Hi. I maintain a script that sets up a Ruby dev environment on macOS using
chruby
andruby-install
, and it has been working wonderfully so far. I think the last time I tested it on a fresh installation of Catalina was earlier this week, and it ran successfully. A few days ago, I started getting reports that the script wasn't working for some people due tocannot load such file -- openssl
. The confusing part is that even though the Ruby installation ran into OpenSSL errors, it still installed Ruby in~/.rubies
and runningchruby 2.7.2
andwhich ruby
seemed to indicate everything was fine, but when they tried to install a gem, they ran into this error:On my main computer, I tried to see if I could reproduce this by removing a Ruby version that I didn't need:
rm -rf ~/.rubies/ruby-2.7.0/
, and then reinstalled it withruby-install 2.7.0
. I got the same OpenSSL errors. I'm pretty sure this is the first time I have run into this withruby-install
.Another thing I tried to see if it was a problem specific to my computer or if it was due to
ruby-install
was to install Ruby 2.7.0 viaasdf
, and that worked just fine.Any idea why this would be failing all of a sudden?
Here's the output of
sw_vers
on my machine: