rbenv - Error compiling Ruby 2.1.1 - ruby

I have problems compiling Ruby on a DigitalOcean Droplet.
rbenv 0.4.0-97-gfe0b243
Ubuntu 14.04 LTS
Linux bashman 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
rbenv install 2.1.1
gives me: https://gist.github.com/astropanic/e4d3a3602612b3c21636
The failure seems to be related to:
compiling readline.c
readline.c: In function ‘Init_readline’:
readline.c:1977:26: error: ‘Function’ undeclared (first use in this function)
rl_pre_input_hook = (Function *)readline_pre_input_hook;
^
readline.c:1977:26: note: each undeclared identifier is reported only once for each function it appears in
readline.c:1977:36: error: expected expression before ‘)’ token
rl_pre_input_hook = (Function *)readline_pre_input_hook;
^
readline.c: At top level:
readline.c:634:1: warning: ‘readline_pre_input_hook’ defined but not used [-Wunused-function]
readline_pre_input_hook(void)
^
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory `/tmp/ruby-build.20140502004823.5335/ruby-2.1.1/ext/readline'
make[1]: *** [ext/readline/all] Error 2
make[1]: Leaving directory `/tmp/ruby-build.20140502004823.5335/ruby-2.1.1'
make: *** [
build-ext] Error 2
Any ideas ?

The failure to build ruby 2.1 because of readline appears to be a known error.
I was successful building it using one of the suggested patches like this:
curl -fsSL https://gist.github.com/mislav/a18b9d7f0dc5b9efc162.txt | rbenv install --patch 2.1.1
Downgrading the readline library to version 6.2.4 is an alternative suggestion but I haven't tried that.

Following will solve your problem:
sudo apt install libssl1.0-dev

Related

How to download Ruby (<2.0) on virtualbox/ubunto 20.04 using rbenv

I am having issues installing Ruby with rbenv and it appears to be an openssl issue. I have followed the below links with no success
Links:
OpenSSL error installing Ruby 2.1.x and 2.3.x on Archlinux with ruby-install/ruby-build
https://github.com/rbenv/ruby-build/wiki#openssl-sslv3_method-undeclared-error
Ubuntu 20.04
OpenSSL 1.0.2
ruby-build 20211019
scoop#scoop-VirtualBox:~$ rbenv install 1.9.3-p327
Downloading yaml-0.1.6.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /home/scoop/.rbenv/versions/1.9.3-p327
Downloading ruby-1.9.3-p327.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.bz2
Installing ruby-1.9.3-p327...
WARNING: ruby-1.9.3-p327 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
BUILD FAILED (Ubuntu 20.04 using ruby-build 20211019)
Inspect or clean up the working tree at /tmp/ruby-build.20211022151319.51817.ZFwydR
Results logged to /tmp/ruby-build.20211022151319.51817.log
Last 10 log lines:
| ^~~~~~~~~~~~
ossl_ocsp.c: In function ‘ossl_ocspcid_get_serial’:
ossl_ocsp.c:694:1: warning: control reaches end of non-void function [-Wreturn-type]
694 | }
| ^
make[2]: *** [Makefile:267: ossl_ocsp.o] Error 1
make[2]: Leaving directory '/tmp/ruby-build.20211022151319.51817.ZFwydR/ruby-1.9.3-p327/ext/openssl'
make[1]: *** [exts.mk:126: ext/openssl/all] Error 2
make[1]: Leaving directory '/tmp/ruby-build.20211022151319.51817.ZFwydR/ruby-1.9.3-p327'
make: *** [uncommon.mk:178: build-ext] Error 2
I found Ubuntu > 18.04 does not have the correct dependencies to support OpenSSL 1.0 so I switched to 18.04 and did the following:
# cd into source directory you downloaded and unarchived
./config --prefix=/opt/openssl-1.0 shared
make
make test
sudo make install
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/openssl-1.0" rbenv install <version>
this comes from the below link:
https://github.com/rbenv/ruby-build/wiki#openssl-sslv3_method-undeclared-error

Cannot install ruby with ASDF

I'm trying to install ruby 2.2.10 with ASDF without success. I tried to find on my own why it's this happening now. Not sure if some brew update it breaks it or what.
Here I share the output of the install:
asdf install
elixir 1.10.2-otp-22 is already installed
elm 0.18.0 is already installed
istioctl 1.4.7 is already installed
Downloading openssl-1.0.2u.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
Installing openssl-1.0.2u...
Installed openssl-1.0.2u to /Users/murbano/.asdf/installs/ruby/2.2.10
Downloading ruby-2.2.10.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.10.tar.bz2
Installing ruby-2.2.10...
WARNING: ruby-2.2.10 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: using readline from homebrew
BUILD FAILED (OS X 10.15.6 using ruby-build 20200520)
Inspect or clean up the working tree at /var/folders/47/wxs46t2s6db9fh1zv640mpdr0000gn/T/ruby-build.20200921205118.64211.ty44rI
Results logged to /var/folders/47/wxs46t2s6db9fh1zv640mpdr0000gn/T/ruby-build.20200921205118.64211.log
Last 10 log lines:
compiling complex.c
compiling dir.c
compiling dln_find.c
compiling encoding.c
encoding.c:825:2: error: implicit declaration of function 'rb_str_change_terminator_length' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
rb_str_change_terminator_length(obj, oldtermlen, termlen);
^
1 error generated.
make: *** [encoding.o] Error 1
make: *** Waiting for unfinished jobs....
Also tried with:
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" asdf install
elixir 1.10.2-otp-22 is already installed
elm 0.18.0 is already installed
istioctl 1.4.7 is already installed
Downloading ruby-2.2.10.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.10.tar.bz2
Installing ruby-2.2.10...
WARNING: ruby-2.2.10 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: using readline from homebrew
BUILD FAILED (OS X 10.15.6 using ruby-build 20200520)
Inspect or clean up the working tree at /var/folders/47/wxs46t2s6db9fh1zv640mpdr0000gn/T/ruby-build.20200921210737.34707.yrr2le
Results logged to /var/folders/47/wxs46t2s6db9fh1zv640mpdr0000gn/T/ruby-build.20200921210737.34707.log
Last 10 log lines:
compiling dln_find.c
compiling encoding.c
compiling enum.c
encoding.c:825:2: error: implicit declaration of function 'rb_str_change_terminator_length' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
rb_str_change_terminator_length(obj, oldtermlen, termlen);
^
compiling enumerator.c
1 error generated.
make: *** [encoding.o] Error 1
make: *** Waiting for unfinished jobs....
brew --prefix openssl
/usr/local/opt/openssl#1.1
I installed XCode, restarted, something it's stoping the install but I'm not sure why.
That happened after uninstalled ruby to do a new clean install.

Error installing gnupg2 dependency libusb using homebrew

I'm installing gnupg2 using homebrew on mac osx and getting errors intstalling the dependency libusb.
brew install gpg2
....
==> Installing gnupg2 dependency: libusb
==> Downloading http://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2
Already downloaded: /Library/Caches/Homebrew/libusb-1.0.9.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/libusb/1.0.9
==> make install
os/darwin_usb.c:1749: error: old-style parameter declarations in prototyped function definition
os/darwin_usb.c:1749: error: expected '{' at end of input
make[1]: *** [libusb_1_0_la-darwin_usb.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [install-recursive] Error 1
Any ideas how to fix this?
Thanks
Had the same problem, fixed it by installing the XCode command line tools (previously was using gcc standalone package)

Segmentation fault while compiling ruby 1.9.3p392 with OpenSSL 1.0.1e installed

I'm trying to have my Rails website running on my fresh installation of Mountain Lion Server. Not using RVM, because I don't need many rails or ruby installations. Configuring ruby and rails to run smoothly is a pain in the ass.
Compiled the newest version of OpenSSL with these commands:
sudo ./configure --prefix=/usr/local/ darwin64-x86_64-cc
sudo make
sudo make install
Now when I type I get this:
grid:ruby-1.9.3-p392 Clu$ openssl version
OpenSSL 1.0.1e 11 Feb 2013
When I try to configure Ruby from source, I get to Segmentation Fault:
compiling md5init.c
compiling md5ossl.c
linking shared-object digest/md5.bundle
installing default md5 libraries
compiling rmd160init.c
compiling rmd160ossl.c
linking shared-object digest/rmd160.bundle
installing default rmd160 libraries
compiling sha1init.c
compiling sha1ossl.c
linking shared-object digest/sha1.bundle
collect2: ld terminated with signal 11 [Segmentation fault: 11]
make[2]: *** [../../../.ext/x86_64-darwin12.2.1/digest/sha1.bundle] Error 1
make[1]: *** [ext/digest/sha1/all] Error 2
make: *** [build-ext] Error 2

Phusion Passenger Ubuntu 11.10

I just upgraded to ubuntu 11.10 and I have a problem starting phusion passenger. I get the following error:
/usr/bin/ld: /usr/lib/ruby/gems/1.8/gems/passenger-3.0.8/ext/nginx/../common/libpassenger_common.a(aggregate.o): undefined reference to symbol 'round##GLIBC_2.2.5'
/usr/bin/ld: note: 'round##GLIBC_2.2.5' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/libm.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/libm.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory `/tmp/root-passenger-23103/nginx-1.0.5'
make: *** [build] Error 2
Was wondering if there is a fix for this issue or if it is a known issue that may be fixed soon.
Thanks
To fix this problem install gcc-4.4.
sudo apt-get install gcc-4.4 g++-4.4 libstdc++6-4.4-dev
rvmsudo CC=gcc-4.4 passenger-install-nginx-module
The rvmsudo solution did not work for me, as I had the passenger gem already installed, and rvm wanted to use that instead of the system-wide one that rvmsudo installed.
What did work for me is:
sudo apt-get install gcc-4.4 g++-4.4 libstdc++6-4.4-dev
CC=gcc-4.4 passenger start

Resources