I'm trying to get the Ruby gem "Nokogiri" running on a Solaris machine where I don't have root priviledges. What I've done so far:
- I've build my own ruby version (1.9.2p180) in my home directory
- tried to install nokogiri with "gem install nokogiri"
The gem install then throwed this error:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/home/bender/ruby/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
So I downloaded and build the libiconv in /home/myuser/work/libiconv
$ ls /home/myuser/work/libiconv/
bin build include lib share
And passed the locations as arguments for nokogiri:
gem install nokogiri -- --with-iconv-dir=/home/myuser/work/libiconv --with-iconv-include=/home/myuser/work/libiconv/include --with-iconv-lib=/home/myuser/work/libiconv/lib
Now the gem builds and no errors are displayed. The problem is, when I now try to use it, e.g. in irb it somehow fails to load:
require 'nokogiri'
LoadError: ld.so.1: ruby: fatal: libiconv.so.2: open failed: No such file or directory - /home/myuser/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri/nokogiri.so
from /home/myuser/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/myuser/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/myuser/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri.rb:13:in `<top (required)>'
from /home/myuser/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:57:in `require'
from /home/myuser/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:57:in `rescue in require'
from /home/myuser/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from (irb):1
from /home/myuser/ruby/bin/irb:12:in `<main>'
But when I look for the file which should be missing it is there and also readable/executable:
ll /home/myuser/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri/
total 66
...
-rwxr-xr-x 1 myuser group 370552 Jun 6 22:53 nokogiri.so
...
Ok, and that is where I'm stuck.. the file is there but can't be opened? I tried to rebuild the libiconv which had no effect. Nokogiri doesn't throw any error that the build process fails. So I don't know how to solve this and google could't give me answers either. I hope somebody here can give me some hints.
/edit
I googled around some more and found this post where somebody uses ldd to show dependencies. When I do the same for nokogiri it says:
ldd /home/myuser/ruby/bin/nokogiri
ldd: /home/myuser/ruby/bin/nokogiri: unsupported or unknown file type
I guess this is because its a ruby file but in case it is relevant I want to mention it.