Ruby-build: Ruby 2.3.8 fails

Created on 6 Jun 2019  路  4Comments  路  Source: rbenv/ruby-build

I installed ruby-build as a plugin of rbenv.

$ rbenv install 2.3.8
Downloading ruby-2.3.8.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.8.tar.bz2
Installing ruby-2.3.8...

BUILD FAILED (Arch Linux using ruby-build 20190423-4-gac92ec0)

Inspect or clean up the working tree at /tmp/ruby-build.20190606160901.2131
Results logged to /tmp/ruby-build.20190606160901.2131.log

Last 10 log lines:
make[2]: *** [Makefile:302: ossl.o] Error 1
make[2]: *** [Makefile:302: ossl_asn1.o] Error 1
make[2]: Leaving directory '/tmp/ruby-build.20190606160901.2131/ruby-2.3.8/ext/openssl'
make[1]: *** [exts.mk:212: ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/tmp/ruby-build.20190606160901.2131/ruby-2.3.8/ext/objspace'
linking shared-object nkf.so
make[2]: Leaving directory '/tmp/ruby-build.20190606160901.2131/ruby-2.3.8/ext/nkf'
make[1]: Leaving directory '/tmp/ruby-build.20190606160901.2131/ruby-2.3.8'
make: *** [uncommon.mk:203: build-ext] Error 2

I git cloned the repo today (master branch commit 4e923221ce57a04ab52bddd638473d566347711f).

Full logs: https://pastebin.com/raw/0Ysan49v

Same as #1303

Most helpful comment

I managed to make this work by first installing openssl-1.0.2u manually (download and uncompress tarball, then):

./config --prefix=/opt/openssl-1.0 shared
make
sudo make install

Then compiling ruby 2.3.8 against that, using openssl in the above location:

cflags=-I/opt/openssl-1.0/include LDFLAGS='-L/opt/openssl-1.0/lib -Wl,-rpath,/opt/openssl-1.0/lib' rbenv install 2.3.8

The ssl extension now links against the library in /opt/openssl-1.0:

$ ldd ~/.rbenv/versions/2.3.8/lib/ruby/2.3.0/x86_64-linux/openssl.so
    linux-vdso.so.1 (0x00007fff19716000)
    libssl.so.1.0.0 => /opt/openssl-1.0/lib/libssl.so.1.0.0 (0x00007fce42a31000)
    libcrypto.so.1.0.0 => /opt/openssl-1.0/lib/libcrypto.so.1.0.0 (0x00007fce427d4000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fce4279c000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fce425aa000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fce425a4000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fce42b05000)

All 4 comments

Same as #1303

Maybe, No.

What's your openssl version? If you use OpenSSL 1.1.x on Archlinux, You need to use Ruby 2.4+ instead of Ruby 2.3.

ref. https://github.com/rbenv/ruby-build/issues/1308#issuecomment-499741719

@hsbt You're right. But that was for a project that was specifically working with 2.3.x. I did the modifications to the project so now it works under 2.6.x.

I managed to make this work by first installing openssl-1.0.2u manually (download and uncompress tarball, then):

./config --prefix=/opt/openssl-1.0 shared
make
sudo make install

Then compiling ruby 2.3.8 against that, using openssl in the above location:

cflags=-I/opt/openssl-1.0/include LDFLAGS='-L/opt/openssl-1.0/lib -Wl,-rpath,/opt/openssl-1.0/lib' rbenv install 2.3.8

The ssl extension now links against the library in /opt/openssl-1.0:

$ ldd ~/.rbenv/versions/2.3.8/lib/ruby/2.3.0/x86_64-linux/openssl.so
    linux-vdso.so.1 (0x00007fff19716000)
    libssl.so.1.0.0 => /opt/openssl-1.0/lib/libssl.so.1.0.0 (0x00007fce42a31000)
    libcrypto.so.1.0.0 => /opt/openssl-1.0/lib/libcrypto.so.1.0.0 (0x00007fce427d4000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fce4279c000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fce425aa000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fce425a4000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fce42b05000)

Didn't work for me @ayqazi solution was generating core dump.

I installed openssl-1.0.2.u from https://www.openssl.org/source/old/1.0.2/

./config --prefix=/opt/openssl-1.0 shared
make
sudo make install

And installed ruby 2.3.8 with this alternative command:

CONFIGURE_OPTS="--with-openssl-dir=/opt/openssl-1.0 --disable-install-rdoc --disable-install-ri --enable-shared" rbenv install 2.3.8 -v

Was this page helpful?
0 / 5 - 0 ratings