I'm getting the following error when trying to use rbenv/ruby-build.
`$ rbenv install 2.1.2
Downloading ruby-2.1.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
Installing ruby-2.1.2...
BUILD FAILED (ManjaroLinux 15.12 using ruby-build 20160330)
Inspect or clean up the working tree at /tmp/ruby-build.20160403133552.9913
Results logged to /tmp/ruby-build.20160403133552.9913.log
Last 10 log lines:
installing default ripper libraries
linking shared-object racc/cparse.so
make[2]: Leaving directory '/tmp/ruby-build.20160403133552.9913/ruby-2.1.2/ext/racc/cparse'
linking shared-object readline.so
make[2]: Leaving directory '/tmp/ruby-build.20160403133552.9913/ruby-2.1.2/ext/readline'
linking shared-object ripper.so
make[2]: Leaving directory '/tmp/ruby-build.20160403133552.9913/ruby-2.1.2/ext/ripper'
make[1]: Leaving directory '/tmp/ruby-build.20160403133552.9913/ruby-2.1.2'
uncommon.mk:180: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
`
I've tried a patched methofr for 2.1.1 i found on here and got similar issues.
`$ rbenv install 2.1.2
Downloading ruby-2.1.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
Installing ruby-2.1.2...
BUILD FAILED (ManjaroLinux 15.12 using ruby-build 20160330)
Inspect or clean up the working tree at /tmp/ruby-build.20160403133552.9913
Results logged to /tmp/ruby-build.20160403133552.9913.log
Last 10 log lines:
installing default ripper libraries
linking shared-object racc/cparse.so
make[2]: Leaving directory '/tmp/ruby-build.20160403133552.9913/ruby-2.1.2/ext/racc/cparse'
linking shared-object readline.so
make[2]: Leaving directory '/tmp/ruby-build.20160403133552.9913/ruby-2.1.2/ext/readline'
linking shared-object ripper.so
make[2]: Leaving directory '/tmp/ruby-build.20160403133552.9913/ruby-2.1.2/ext/ripper'
make[1]: Leaving directory '/tmp/ruby-build.20160403133552.9913/ruby-2.1.2'
uncommon.mk:180: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
`
Can you try with Ruby 2.1.10? 2.1.2 is obsoleted version.
I'm also currently running into a build failure when trying with 2.2.0. I'm running 4.6.2.1 - Arch.
2.1.6 fails in Arch for me. 2.1.10 builds and should be fine for me.
Sorry to open such a old thread but I had the same issues with ruby-build on arch linux with ruby versions < 2.4.x
I tried 2.3.x , 2.2.x and 2.1.10 but all failed
One of the failed log message
BUILD FAILED (Arch Linux using ruby-build 20170405-2-g3b15693)
Last 10 log lines:
make[2]: Leaving directory '/tmp/tmp.G9RDBWY5so/ruby-build.20170510223041.26434/ruby-2.3.4/ext/openssl'
make[1]: *** [exts.mk:209: ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/tmp/tmp.G9RDBWY5so/ruby-build.20170510223041.26434/ruby-2.3.4/ext/objspace'
linking shared-object json/ext/generator.so
make[2]: Leaving directory '/tmp/tmp.G9RDBWY5so/ruby-build.20170510223041.26434/ruby-2.3.4/ext/json/generator'
linking shared-object nkf.so
make[2]: Leaving directory '/tmp/tmp.G9RDBWY5so/ruby-build.20170510223041.26434/ruby-2.3.4/ext/nkf'
make[1]: Leaving directory '/tmp/tmp.G9RDBWY5so/ruby-build.20170510223041.26434/ruby-2.3.4'
make: *** [uncommon.mk:203: build-ext] Error 2
I would be glad to assist in any way possible and close this issue.
Had the same issue, here is my proposed workaround.
I caught onto this issue for debian, and just adjusted the solution for an arch environment:
# install the openssl-1.0 package
sudo pacman -S openssl-1.0
# download v1.0.2.k of the openssl package
wget https://archive.archlinux.org/packages/o/openssl/openssl-1.0.2.k-1-x86_64.pkg.tar.xz
# extract a copy of the package (for compilation purposes) somewhere temporary
mkdir /tmp/openssl-1.0.2.k
tar -xf openssl-1.0.2.k-1-x86_64.pkg.tar.xz -C /tmp/openssl-1.0.2.k
# build + install ruby with openssl-1.0.2.k
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/tmp/openssl-1.0.2.k/usr rbenv install 2.3.1
# > Installing ruby-2.3.1...
# > Installed ruby-2.3.1 to /home/user/.rbenv/versions/2.3.1
Also to note, there were two other issues to resolve before the package would compile for me.
sudo pacman -S --needed base-devel libffi libyaml openssl zlib
wget https://archive.archlinux.org/packages/g/gcc/gcc-6.3.1-2-x86_64.pkg.tar.xz
wget https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-6.3.1-2-x86_64.pkg.tar.xz
sudo pacman -U gcc-6.3.1-2-x86_64.pkg.tar.xz gcc-libs-6.3.1-2-x86_64.pkg.tar.xz
@alecdwm 's solution work as well. There is also another solution proposed by @piotrdz on another issue thread https://github.com/rbenv/ruby-build/issues/834#issuecomment-301689257
@jatindhankhar @alecdwm This solution works for 2.3.x but does not seem to work for ruby 2.2.x - Can you verify this?
Edit:
I managed to install Ruby 2.2.0 by choosing an even older version of openssl:
wget https://archive.archlinux.org/packages/o/openssl/openssl-1.0.1.e-3-x86_64.pkg.tar.xz
@henvo Did you get the OpenSSL “SSLv3_method undeclared” error when installing 2.2.0? If so, a workaround exists here.
Edit: There's also a concise summary here!
If not already installed you need Open SSL 1.0:
pacman -S openssl-1.0For installing Ruby 2.3.x the following is needed:
PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig ruby-install ruby 2.3.0I installed 2.3.0, 2.3.1 and 2.3.4 this way.
For Ruby 2.1.x and 2.2.x a patch is also needed:
curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt > ruby2.x-openssl.patch PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig ruby-install -p ruby2.x-openssl.patch ruby 2.1.5I installed 2.1.5 and 2.1.6 this way.
For older versions of Ruby (< 2) a different patch may be needed which can be downloaded here:
https://github.com/rbenv/ruby-build/wiki#openssl-sslv3_method-undeclared-error
I am on 4.9.35-1-MANJARO
Tried everything @jatindhankhar @alecdwm and @henvo suggested.
Tried multiple older versions of openssl, gcc-7, gcc63, gcc-5, it wont compile.
Below the end of the log, any suggestions?
openssl_missing.h:79:35: error: macro "EVP_MD_CTX_create" passed 1 arguments, but takes just 0
EVP_MD_CTX *EVP_MD_CTX_create(void);
^
In file included from /usr/include/openssl/x509.h:23:0,
from /usr/include/openssl/x509v3.h:14,
from ossl.h:59,
from ossl_x509name.c:11:
openssl_missing.h:83:6: error: expected declaration specifiers or ‘...’ before ‘(’ token
void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
^
openssl_missing.h:91:6: error: expected declaration specifiers or ‘...’ before ‘(’ token
void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
^
compiling psych.c
ossl_x509name.c: In function ‘ossl_x509name_to_a’:
ossl_x509name.c:294:58: error: dereferencing pointer to incomplete type ‘X509_NAME_ENTRY {aka struct X509_name_entry_st}’
if (!i2t_ASN1_OBJECT(long_name, sizeof(long_name), entry->object)) {
^
make[2]: *** [Makefile:293: ossl_x509name.o] Error 1
make[2]: Leaving directory '/tmp/ruby-build.20170714130802.31169/ruby-2.2.3/ext/openssl'
make[1]: *** [exts.mk:201: ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
compiling psych_to_ruby.c
linking shared-object objspace.so
make[2]: Leaving directory '/tmp/ruby-build.20170714130802.31169/ruby-2.2.3/ext/objspace'
linking shared-object json/ext/generator.so
linking shared-object psych.so
installing default psych libraries
make[2]: Leaving directory '/tmp/ruby-build.20170714130802.31169/ruby-2.2.3/ext/json/generator'
make[2]: Leaving directory '/tmp/ruby-build.20170714130802.31169/ruby-2.2.3/ext/psych'
linking shared-object pathname.so
make[2]: Leaving directory '/tmp/ruby-build.20170714130802.31169/ruby-2.2.3/ext/pathname'
linking shared-object bigdecimal.so
make[2]: Leaving directory '/tmp/ruby-build.20170714130802.31169/ruby-2.2.3/ext/bigdecimal'
linking shared-object date_core.so
make[2]: Leaving directory '/tmp/ruby-build.20170714130802.31169/ruby-2.2.3/ext/date'
linking shared-object nkf.so
make[2]: Leaving directory '/tmp/ruby-build.20170714130802.31169/ruby-2.2.3/ext/nkf'
make[1]: Leaving directory '/tmp/ruby-build.20170714130802.31169/ruby-2.2.3'
make: *** [uncommon.mk:189: build-ext] Error 2
Hey @abieler I was having the same problem on Arch and I solved it by both, using openssl-1.0 + specifying the PKG_CONFIG path and applying the "SSLv3_method" patch.
I was able to install with the following command: curl -fsSL https://gist.github.com/FiveYellowMice/c50490693d47577cfe7e6ac9fc3bf6cf.txt | PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig:/usr/lib/pkgconfig rbenv install --patch 1.9.3-p551
If you are installing a higher version you would need the other patch mentioned here: sslv3_patch
Hope this works for you!
It was definitely a hassle for me, I'll try to make a PR request so at least the docs are right for other people running into the same issue.
@agush22 you gave me back hope! Had to additionally point to gcc-5, but then it finally worked for 2.2.3 on Arch with the following line:
curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt | PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig:/usr/lib/pkgconfig CC=/usr/bin/gcc-5 rbenv install --patch 2.2.3
Installing gcc5 community package, then
sudo pacman -S openssl-1.0
and doing:
CC=gcc-5 PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig RUBY_EXTRA_CONFIGURE_OPTIONS="--with-openssl-dir=/usr/lib/openssl-1.0" rbenv install 2.2.5
worked for me!
For building on Manjaro Linux the following seems to do the trick for both ruby-2.3.5 and ruby-2.2.8:
gem: --user-install from /etc/gemrcsudo pacman -S gcc6 openssl-1.0PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig CC=/usr/bin/gcc-6 rbenv install 2.3.5Should probably work on Arch Linux as well. The full(?) list of dependencies for rbenv in general, with older gcc and ssl added: sudo pacman -S gcc6 base-devel libffi libyaml openssl zlib openssl-1.0.
I just installed a fresh version of Arch yesterday which comes with gcc 7. What @e12e did worked for me for installing ruby 2.3.0 using rbenv on Arch Linux with the exception that I didn't need to touch /etc/gemrc (there is no such file on Arch).
For anyone else that's curious, yes I tried installing ruby 2.3.0 with just gcc 7 and that failed to work, unfortunately. So, yes, you do need to use a version of gcc less than 7.
Related: https://bugs.ruby-lang.org/issues/14076
UPDATE: Just needed to do the same thing to install ruby 2.3.7 on Arch. Worked.
Most helpful comment
Had the same issue, here is my proposed workaround.
I caught onto this issue for debian, and just adjusted the solution for an arch environment:
Also to note, there were two other issues to resolve before the package would compile for me.