Monday, February 22, 2010

Can't find tokyocabinet native extention

luan@luan-laptop:~/app/software/ruby/tokyo_projects$ ruby hash_db.rb
hash_db.rb:1:in `require': cannot open shared object file: No such file or directory - /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/x86_64-linux/ (LoadError)
from hash_db.rb:1:in `

he solution was to modify the LD_LIBRARY_PATH to include /usr/local/lib or to where the ruby lib is located.


sudo vi .bashrc


export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

Tuesday, February 9, 2010

install ruby 1.9.1 script



mkdir -p /usr/local/src && cd /usr/local/src
tar -xjvf ruby-1.9.1-p$PATCH.tar.bz2
cd ruby-1.9.1-p$PATCH
./configure --prefix=/usr --program-suffix=19 --enable-shared
make && make install

install ruby 1.9.1p376 on Ubuntu 9.10

First, remove any ruby version on the system:

sudo apt-get remove --purge ruby1.8 ruby1.9

-- package build dependencies (ruby)

sudo apt-get build-dep ruby1.9

-- get ruby 1.9 source
-- if you can't get it, try to download from

wget -c

-- extract ruby source using tar

tar -xvzf ruby-1.9.1-p376.tar.gz

-- go to extracted ruby code dir

cd ruby-1.9.1-p376/

-- execute configure
./configure --prefix=/opt/ruby-1.9.1-p376 --enable-shared

-- execute make command

-- install process
sudo make install

Then I add the following line to the bottom of $HOME/.bash_profile

luan@luan-desktop:~$ cat .bash_profile
export OC4J_HOME=/opt/oc4j

export JAVA_HOME=/opt/java
export ECLIPSE_HOME=/opt/eclipse
export GROOVY_HOME=/opt/groovy

export GRAILS_HOME=/opt/grails
export TNS_ADMIN=/opt/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export RUBY_HOME=/opt/ruby


export AWT_TOOLKIT=MToolkit

Create a link:

luan@luan-desktop:/opt$ ln -s /opt/ruby-1.9.1-p0 /opt/ruby

luan@luan-desktop:/$ cd

luan@luan-desktop:/$ s
ource .bash_profile

luan@luan-desktop:/$ ruby -v
ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]

If you are using ruby gem, you need to type:
sudo /opt/ruby/bin/gem