Ruby Solaris Install

From EggeWiki
Jump to navigation Jump to search

This is for installing Ruby without root access into your home directory. Mostly I followed the advice on and

First we need to build readline:

tar xzvf readline-5.1.tar.gz
cd readline-5.1
./configure --prefix=/u/eggebr/pkgs/`archpath`
make install
cd ..

Now for Ruby itself:

tar xzvf ruby-1.8.4.tar.gz 
cd ruby-1.8.4
./configure --prefix=/u/eggebr/pkgs/`archpath` --with-readline-dir=/u/eggebr/pkgs/`archpath`
make install

Assuming we have tk already installed, we can build the tk extension.

cd ext/tk
ruby extconf.rb --with-tcl-dir=/usr/local/pkgs/tcl-8.3.5 --with-tk-dir=/usr/local/pkgs/tk-8.3.5 --with-tcllib=tcl8.3 --with-tklib=tk8.3 --enable-tcltk_stubs
make && make install
cp -fr /usr/local/pkgs/tk-8.3.5/* /u/eggebr/pkgs/sunos-5.10-i86pc

Now, I just need to test things out.

require 'tk'
root = { title "Hello, world!" }

To get Rails installed, I'm going to need the crypto stuff working. For whatever reason, the Ruby install can find the crypto library, but the linker doesn't link an absolute path. As a consequence, I have to specify the path to my in my LD_LIBRARY_PATH.

$ ldd /u/eggebr/pkgs/sunos-5.10-i86pc/lib/ruby/1.8/i386-solaris2.10/digest/ =>    (file not found) =>    /lib/ =>       /usr/lib/ =>     /lib/ =>     /lib/ =>   /lib/

$ ruby -rmd5 -e 'p MD5.md5 "Hello"'
/u/eggebr/pkgs/sunos-5.10-i86pc/lib/ruby/1.8/i386-solaris2.10/digest/ ruby: fatal: open failed: No such file or directory - /u/eggebr/pkgs/sunos-5.10-i86pc/lib/ruby/1.8/i386-solaris2.10/digest/ (LoadError)
        from /u/eggebr/pkgs/sunos-5.10-i86pc/lib/ruby/1.8/md5.rb:6
$ export LD_LIBRARY_PATH=/usr/local/pkgs/openssl-0.9.7i/lib
$ ruby -rmd5 -e 'p MD5.md5 "Hello"'
-e:1: warning: parenthesize argument(s) for future version

Now we can install Ruby Gems:

$ wget
$ tar xzvf rubygems-0.8.11.tgz
$ cd ./rubygems-0.8.11
$ ruby setup.rb

If you are installing rails as sudo, it's a bit more tricky, because sudo erases your LD_LIBRARY_PATH. I simply created a small script to launch the setup.

LD_LIBRARY_PATH=/usr/local/pkgs/openssl-0.9.7i/lib && export LD_LIBRARY_PATH
exec $@

With Ruby Gems installed, we're ready to install Rails as per

$ gem install rails --include-dependencies

If you've made it this far, you could venture onto installing Ruby Sybase Solaris, which will make the above seem easy.

Update May 26, 2009

I don't have a problem with the extension when building 32 bit binaries using gcc, however, sometimes the 64 bit shared libraries build with Sun's cc 5.8 have 'relocation' problems. Example:

$ ruby -e "require 'irb/completion' "
/home/egge/lib/ruby/1.8/i386-solaris2.10/ ruby: fatal: relocation error: R_AMD64_32: file /home/egge/lib/ruby/1.8/i386-solaris2.10/ symbol (unknown): value 0xfffffd7fff179adc does not fit - /home/egge/lib/ruby/1.8/i386-solaris2.10/ (LoadError)
        from /home/egge/lib/ruby/1.8/irb/completion.rb:10
        from -e:1:in `require'
        from -e:1

The work around seems to be to edit ext/Setup, and uncomment 'readline'. Additionally, I uncommented stringio and zlib. I tried to uncomment just 'option nodynamic' at the top, but that caused other build problems. See static linking.