Current time: 03-24-2017, 01:02 PM Hello There, Guest! (LoginRegister)

Post Reply 
Real Trouble Trying To Install Gem with Native Ext
05-15-2009, 08:38 AM
Post: #1
Real Trouble Trying To Install Gem with Native Ext
Hi all,

So I've been pushing through to get pauldix-feedzirra working on my account but it requires libxslt, which isn't installed in a way that I can compile a gem with.

So I downloaded libxslt and compiled/installed it successfully in my account. It is nokogiri as a dependency to pauldix-feedzirra that complains it can't find it first, so I simply (after a lot of digging) go into my .gem/gems/nokogiri-1.2.3/ext/nokogiri directory and run with my locally compiled path to libxslt:

"ruby extconf.rb --with-xslt-dir=/home/username/run --prefix=/home/username/.gem/gems and IT COMPILES!

Sadly, this doesn't fix it though. When I try to run gem install pauldix-feedzirra again, it doesn't recognize that nokogiri is installed and writes over the old directory, giving me the same error i was getting when it wasn't compiled. Sad

I don't know if:

A.) the nokogiri gem isn't getting installed into the right place?
or
B.) there's some way to inform the gem install of where those dependencies are (libxslt custom location, etc.) though I haven't found any options for the gem install command that would do that.

ANY HELP!?!? I really need to get this native code usin' gem installed.

Thanks all!
Find all posts by this user
Quote this message in a reply
07-06-2009, 01:55 AM
Post: #2
Real Trouble Trying To Install Gem with Native Ext
hi there.

just figured this out.
to install nokogiri, you need to first install the xslt package (make them yourself in your local directory) and then after that, pass in the right parameters that point the gem installer to the right xslt package.

1. get the package for that library -> download the xslt library that you need http://xmlsoft.org/XSLT/downloads.html

2. in dreamhost do: wget the-ftp-url-from-above

3. decide where to put it and do a ./configure --prefix=/path-where-you-want-to-put-it/

4. make

5. make install

6. gem install nokogiri -- --with-xslt-include=/path-where-you-want-to-put-it/include/ --with-xslt-lib=/path-where-you-want-to-put-it/lib/
Find all posts by this user
Quote this message in a reply
08-09-2009, 08:10 PM
Post: #3
Real Trouble Trying To Install Gem with Native
mrfiocco: thanks for the details! this looks like the approach i was taking but i don't remember the details. i'll post my results here. this seems like a rarely documented (but important) task on dreamhost!

thanks again.
Find all posts by this user
Quote this message in a reply
08-25-2009, 08:37 PM
Post: #4
Real Trouble Trying To Install Gem with Native Ext
Hi mrfiocco,

This worked great. (I think it was the '--' after the install command i was missing.) I was trying to install a gem with multiple other dependencies that required native extensions but I was able to use this method for each of them, downloading them one by one into my home directory, compiling/installing them and then eventually, when all dependencies of the master gem were satisfied, I was able to run the gem install for that successfully.

Now I just need to navigate all the crap about Passenger not recognizing the local GEM environment and I'll be all set. Smile

Thanks again.
Find all posts by this user
Quote this message in a reply
10-17-2009, 10:00 PM
Post: #5
Real Trouble Trying To Install Gem with Native
Thanks, Mr Fiocco.

I fumbled myself along to this same point using bits of other threads about getting libxslt on Dreamhost.

I've got it in the right places, namely
/home/myusername/local/lib and /home/myusername/local/include,
but running the same command as you provided fails:

[gravano]$ gem install nokogiri -- --with-xslt-include=/home/myusername/local/include/ --with-xslt-lib=/home/myusername/local/lib/
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb --with-xslt-include=/home/myusername/local/include/ --with-xslt-lib=/home/myusername/local/lib/
checking for iconv.h in /home/myusername/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for libxml/parser.h in /home/myusername/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for libxslt/xslt.h in /home/myusername/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for libexslt/exslt.h in /home/myusername/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... no
libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel'

But it is not missing. It says it found the header, right? libxslt/xslt.h

I tried reconfiguring and making libxslt, but I'm not sure what is the missing link here.
Find all posts by this user
Quote this message in a reply
10-17-2009, 10:03 PM
Post: #6
Real Trouble Trying To Install Gem with Native
mind2find,

I tried what you did with "ruby extconf.rb" and also was able to compile nokogiri, but had the same problem with feedzirra not finding it.
Find all posts by this user
Quote this message in a reply
02-08-2010, 01:49 PM
Post: #7
Real Trouble Trying To Install Gem with Native
I also was able to get nokogiri installed. I had the xsltstylesheet problem someone else was having but I just got the latest version of libxslt, compiled it, and then I installed nokogiri. I installed two versions. Here's the one no one is mentioning:

l$ gem install tenderlove-nokogiri -- --with-xslt-include=/home/user/local/include/ --with-xslt-lib=/home/user/local/lib/
Successfully installed tenderlove-nokogiri-0.0.0.20081001111445
1 gem installed

But when i open the ruby console and check if it is working I get this problem:

Quote:
Quote:require "nokogiri"

LoadError: /home/user/.gem/ruby/1.8/gems/nokogiri-1.2.3/lib/nokogiri/native.so: cannot open shared object file: No such file or directory - /home/user/.gem/ruby/1.8/gems/nokogiri-1.2.3/lib/nokogiri/native.so
from /home/user/.gem/ruby/1.8/gems/nokogiri-1.2.3/lib/nokogiri/native.so
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/user/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:158:in `require'
from /home/user/.gem/ruby/1.8/gems/nokogiri-1.2.3/lib/nokogiri.rb:6
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /home/user/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:158:in `require'
from (irb):1

But I check to see if I have that file and it is there:

$ ls -la /home/user/.gem/ruby/1.8/gems/nokogiri-1.2.3/lib/nokogiri/native.so
-rwxr-xr-x 1 user pg1585848 793114 May 18 2009 /home/user/.gem/ruby/1.8/gems/nokogiri-1.2.3/lib/nokogiri/native.so

Any ideas?!
Find all posts by this user
Quote this message in a reply
02-08-2010, 02:29 PM
Post: #8
Real Trouble Trying To Install Gem with Native
Here's your problem:
Code:
$ file /home/user/.gem/ruby/1.8/gems/nokogiri-1.2.3/lib/nokogiri/native.so
/home/user/.gem/ruby/1.8/gems/nokogiri-1.2.3/lib/nokogiri/native.so: ELF [b]32-bit[/b] LSB shared object, Intel 80386, version 1 (SYSV), not stripped

$ uname -m
[b]x86_64[/b]
It looks like you've got an old 32-bit gem on a 64-bit system. Get a 64-bit copy of the nokogiri gem and things should go better...
Find all posts by this user
Quote this message in a reply
03-22-2010, 08:49 PM
Post: #9
Real Trouble Trying To Install Gem with Native
I've gone through this post over and over but still have problems. 'ryanrockets' has the same problem as I have (posted 10/17/09). Specifically I get this (abbreviated) output when running gem install:

checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... no
libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel'
*** extconf.rb failed ***

I do this setup:

#!/bin/sh
ROOT=$HOME/local
mkdir $ROOT
cd $ROOT
wget http://ftp.www.xmlsoft.org/libxml2/libxs....26.tar.gz
wget http://ftp.www.xmlsoft.org/libxml2/libxml2-2.7.7.tar.gz
tar xvf libxml2-2.7.7.tar.gz
tar xvf libxslt-1.1.26.tar.gz
cd $ROOT/libxml2-2.7.7
nice ./configure --prefix=$ROOT --without-python
nice make
nice make install
cd $ROOT/libxslt-1.1.26
nice ./configure --prefix=$ROOT --with-libxml-prefix=$ROOT --without-python
nice make
nice make install

And then these both fail as indicated above:

#!/bin/sh
ROOT=$HOME/local
gem install nokogiri -- --with-xslt-include=$ROOT/include --with-xslt-lib=$ROOT/lib

#!/bin/sh
cd $HOME/.gem/gems/nokogiri-1.4.1/ext/nokogiri
ruby extconf.rb --with-xslt-dir=$HOME/local --prefix=$HOME/.gem/gems

Have I failed to setup something else?
Am I using incompatible versions of these libraries?
Am I missing some non explicit detail in the previous posts?

I've been looping on this all day and ran these scripts in a new user account that I created to make sure I had a clean environment. My .bashrc and .bash_profile have these lines:

export GEM_HOME=$HOME/.gem
export GEM_PATH=$GEM_HOME:/usr/lib/ruby/gems/1.8
export PATH=$HOME/.gems/bin:$PATH
export PATH=$HOME/local/bin:$PATH

Help appreciated, thanks, Jim
Find all posts by this user
Quote this message in a reply
03-23-2010, 12:58 PM
Post: #10
Real Trouble Trying To Install Gem with Native
I resolved the build issue. I needed to pick up both libxml2-dev and libxslt1-dev (not libxml2 and libxslt). The following script appears to work:

---------
#!/bin/sh

ROOT=$HOME/local

mkdir $ROOT
cd $ROOT

# libxml2-2.7.7 does not work, need libxml2-dev
# libxslt-1.1.26 does not work, need libxslt1-dev

# Get libxml2-dev
wget http://ftp.de.debian.org/debian/pool/mai...rig.tar.gz
tar xvf libxml2_2.6.32.dfsg.orig.tar.gz

# libxslt1-dev
wget http://ftp.de.debian.org/debian/pool/mai...rig.tar.gz
tar xvf libxslt_1.1.24.orig.tar.gz

cd $ROOT/libxml2-2.6.32
nice ./configure --prefix=$ROOT --without-python
nice make
nice make install

cd $ROOT/libxslt-1.1.24
nice ./configure --prefix=$ROOT --with-libxml-prefix=$ROOT --without-python
nice make
nice make install

gem install nokogiri -- --with-xslt-include=$ROOT/include --with-xslt-lib=$ROOT/lib
--------

I am still wrangling with GEM_PATH and such to get my scripts and passenger deployment running, but thought I'd post the above before I move on.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: