Tuesday, 8 January 2013

Trouble installing rubies through RVM - conflict with environment variables

I was trying to install ruby 1.9.3 through rvm and kept on running against configuration issues:
$ rvm install 1.9.3

No binary rubies available for: downloads/ruby-1.9.3-p362.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /home/xalo/.rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  460k  100  460k    0     0   100k      0  0:00:04  0:00:04 --:--:--  115k
Extracting yaml to /home/xalo/.rvm/src/yaml-0.1.4
Configuring yaml in /home/xalo/.rvm/src/yaml-0.1.4.
Error running './configure --prefix=/home/xalo/.rvm/usr', please read /home/xalo/.rvm/log/ruby-1.9.3-p362/yaml/configure.log
Compiling yaml in /home/xalo/.rvm/src/yaml-0.1.4.
Error running 'make', please read /home/xalo/.rvm/log/ruby-1.9.3-p362/yaml/make.log
Installing Ruby from source to: /home/xalo/.rvm/rubies/ruby-1.9.3-p362, this may take a while depending on your cpu(s)...
ruby-1.9.3-p362 - #downloading ruby-1.9.3-p362, this may take a while depending on your connection...
ruby-1.9.3-p362 - #extracting ruby-1.9.3-p362 to /home/xalo/.rvm/src/ruby-1.9.3-p362
ruby-1.9.3-p362 - #extracted to /home/xalo/.rvm/src/ruby-1.9.3-p362
ruby-1.9.3-p362 - #configuring
Error running './configure --enable-shared --disable-install-doc --prefix=/home/xalo/.rvm/rubies/ruby-1.9.3-p362 --with-opt-dir=/home/xalo/.rvm/usr', please read /home/xalo/.rvm/log/ruby-1.9.3-p362/configure.log
There has been an error while running configure. Halting the installation.

Following the output I took a look at /home/xalo/.rvm/log/ruby-1.9.3-p362/yaml/configure.log:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thr fromead-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/xalo/.rvm/src/yaml-0.1.4':
configure: error: C compiler cannot create executables
See `config.log' for more details

which lead me to /home/xalo/.rvm/src/yaml-0.1.4/config.log and inside I saw a few lines that picked my interest:
configure:3243: checking whether the C compiler works
configure:3265: gcc    conftest.c /home/xalo/libs >&5
/usr/bin/ld: cannot find /home/xalo/libs: File format not recognized

"/home/xalo/libs" is a directory in which I keep libraries and I kept wondering how yaml's configure file was referencing it!

Then I realized I had exported a variable in my .bash_profile:
export LIBS=/home/xalo/libs

I decided to look at /home/xalo/.rvm/src/yaml-0.1.4/configure and found this throughout:
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
so not exporting $LIBS fixed it & and I installed the rubies!!
LIBS=/home/xalo/libs

No comments:

Post a Comment