RVM Bundle install fails at Puma "_SSL_get1_peer_certificate Errro 1"
Rails
RVM
Puma
On M1 macbook when bundle install I get:
#...
ld: Undefined symbols:
_SSL_get1_peer_certificate, referenced from:
_engine_peercert in mini_ssl.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [puma_http11.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/t/.rvm/gems/ruby-3.2.2/gems/puma-6.4.0 for inspection.
Results logged to /Users/t/.rvm/gems/ruby-3.2.2/extensions/arm64-darwin-22/3.2.0/puma-6.4.0/gem_make.out
SOLUTION 1
solution (by soudai-s)
$ bundle config build.puma --with-pkg-config=$(brew --prefix openssl@1.1)/lib/pkgconfig
$ bundle install --redownload
👍 works
BETTER SOLUTION
this a sign of broken link to ssl . Sure above fix will wprk but next time you willhave same issue. Better is to fix the entire RVM ruby
https://github.com/rvm/rvm/issues/5039#issuecomment-1881046360
brew reinstall openssl
brew unlink openssl && brew link openssl --force
# Unlinking /opt/homebrew/Cellar/openssl@3/3.2.0_1... 5802 symlinks removed.
# Linking /opt/homebrew/Cellar/openssl@3/3.2.0_1... 5802 symlinks created.
#check what version was installed
ls /opt/homebrew/Cellar/openssl@3
# 3.2.0_1
rvm install "ruby-3.2.2" --with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.2.0_1 --verify-downloads 1
rvm install "ruby-3.3.0" --with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.2.0_1 --verify-downloads 1
rvm install "ruby-3.3.3" --with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.3.0 --verify-downloads 1
rvm install "ruby-3.4.1" --with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.4.0 --verify-downloads 1
rvm install "ruby-3.4.3" --with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.4.1 --verify-downloads 1
rvm install "ruby-3.4.4" --with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.5.0/ --verify-downloads 1
rvm install "ruby-3.4.5" --with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.5.0/ --verify-downloads 1
rvm install "ruby-3.4.6" --with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.5.1/ --verify-downloads 1
rvm install "ruby-3.4.7" --with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.5.1/ --verify-downloads 1
rvm install "ruby-3.4.8" --with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.6.0 --verify-downloads 1
make sure this is the right location because sometimes it's /opt/homebrew/Cellar/openssl@3/3.3.0/
rvm install "ruby-3.4.1" --with-openssl-dir=`brew --prefix openssl`
note: for some reason rvm install "ruby-3.0.6" --with-openssl-dir=whatever didn't work, I ended up just forcing the project to ruby 3.3
Ubuntu
rvm reinstall 4.0.1 --with-openssl-dir=/home/linuxbrew/.linuxbrew/opt/openssl
In Ubuntu 24
https://docs.seek4science.org/tech/ruby-2.7-ubuntu-22.04
wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz
tar xf openssl-1.1.1n.tar.gz
cd openssl-1.1.1n
./config --prefix=/opt/openssl-1.1.1n --openssldir=/opt/openssl-1.1.1n shared zlib
make
make test
sudo make install
sudo rm -rf /opt/openssl-1.1.1n/certs
sudo ln -s /etc/ssl/certs /opt/openssl-1.1.1n
Install ruby using rvm
rvm install 2.7.4 --with-openssl-dir=/opt/openssl-1.1.1n/