Ruby-build: Every ruby version fails to build

Created on 28 Jul 2017  Â·  8Comments  Â·  Source: rbenv/ruby-build

For Ruby 2.2.2:

✗ tmp env CC=/usr/bin/gcc-5 rbenv install 2.2.2
Downloading ruby-2.2.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.bz2
Installing ruby-2.2.2...

BUILD FAILED (ManjaroLinux 17.0.2 using ruby-build 20170201-7-g5d62e84)

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

Last 10 log lines:
linking shared-object pathname.so
make[2]: Leaving directory '/tmp/ruby-build.20170727182802.9730/ruby-2.2.2/ext/pathname'
linking shared-object bigdecimal.so
make[2]: Leaving directory '/tmp/ruby-build.20170727182802.9730/ruby-2.2.2/ext/bigdecimal'
linking shared-object date_core.so
make[2]: Leaving directory '/tmp/ruby-build.20170727182802.9730/ruby-2.2.2/ext/date'
linking shared-object nkf.so
make[2]: Leaving directory '/tmp/ruby-build.20170727182802.9730/ruby-2.2.2/ext/nkf'
make[1]: Leaving directory '/tmp/ruby-build.20170727182802.9730/ruby-2.2.2'
make: *** [uncommon.mk:189: build-ext] Error 2

And for Ruby 2.1.0:

✗ tmp env CC=/usr/bin/gcc-5 rbenv install 2.1.0
Downloading yaml-0.1.6.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /home/howdoicomputer/.rbenv/versions/2.1.0

Downloading ruby-2.1.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.bz2
Installing ruby-2.1.0...

WARNING: ruby-2.1.0 is nearing its end of life.
It only receives critical security updates, no bug fixes.


BUILD FAILED (ManjaroLinux 17.0.2 using ruby-build 20170201-7-g5d62e84)

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

Last 10 log lines:
linking shared-object json/ext/generator.so
make[2]: Leaving directory '/tmp/ruby-build.20170727183057.25779/ruby-2.1.0/ext/json/generator'
linking shared-object date_core.so
make[2]: Leaving directory '/tmp/ruby-build.20170727183057.25779/ruby-2.1.0/ext/date'
linking shared-object dl/callback.so
make[2]: Leaving directory '/tmp/ruby-build.20170727183057.25779/ruby-2.1.0/ext/dl/callback'
linking shared-object nkf.so
make[2]: Leaving directory '/tmp/ruby-build.20170727183057.25779/ruby-2.1.0/ext/nkf'
make[1]: Leaving directory '/tmp/ruby-build.20170727183057.25779/ruby-2.1.0'
make: *** [uncommon.mk:180: build-ext] Error 2

I'm trying to install older versions of Ruby because I need an older version of JSON because I need to use an older version of the Chef command line tool, knife.

Most helpful comment

I just installed ruby 2.1.10 on Arch using openssl 1.0 to compile, running this command:

PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig \
CFLAGS+=" -I/usr/include/openssl-1.0" \
LDFLAGS+=" -L/usr/lib/openssl-1.0 -lssl" \
rbenv install 2.3.5

Make sure you have openssl-1.0 installed running: pacman -S openssl-1.0

All 8 comments

I'm not familiar ManjaroLinux. Can you show the full log of failing case?

Manjaro is based on Arch Linux. You need to apply the openssl patch:

curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt > ruby2.x-openssl.patch

CC="gcc-5" PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig rbenv install --patch 2.2.2 < ruby2.x-openssl.patch

You will need the following dependencies:

sudo pacman -S gcc5 openssl-1.0

EDIT: Formatted instructions

Same issue here. rbenv install 2.3.5 fails on Arch Linux with the latest rbenv release (2017-09-14).
@hsbt I have attached the full log of the failing compilation. Hope it helps with analysis!

ruby-build.log.zip

I just installed ruby 2.1.10 on Arch using openssl 1.0 to compile, running this command:

PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig \
CFLAGS+=" -I/usr/include/openssl-1.0" \
LDFLAGS+=" -L/usr/lib/openssl-1.0 -lssl" \
rbenv install 2.3.5

Make sure you have openssl-1.0 installed running: pacman -S openssl-1.0

@smarquez1 Thanks, this works for me!

@hsbt In which directories does rbenv look for the OpenSSL library by default?
Are /usr/lib and /usr/include not among those default places?

Thanks @smarquez1 your solution worked for me, hours trying to fix this issue.
I used this solution on Arch Linux and with ruby-install

PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig \
CFLAGS+=" -I/usr/include/openssl-1.0" \
LDFLAGS+=" -L/usr/lib/openssl-1.0 -lssl" \
ruby-install ruby 2.3.5

I have tried this and then it threw 'usr/lib/openssl-1.0': Permission denied.

Please help me

Closing as stale

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kriscard picture kriscard  Â·  5Comments

tom-mayer picture tom-mayer  Â·  3Comments

florentmorin picture florentmorin  Â·  5Comments

ghost picture ghost  Â·  4Comments

eddroid picture eddroid  Â·  4Comments