Problem Installing on Dreamhost

57 views
Skip to first unread message

David Alan Hjelle

unread,
Nov 15, 2009, 9:51:35 PM11/15/09
to nokogiri-talk
Hi!

While I realize that many will say "use a different host," well, I
could. I'm just nearly done with this project and using nokogiri on an
optional feature, so my easiest solution is to just drop it. Before I
do that, however, I wanted to give the wisdom of the list a try.

Dreamhost does not have a current enough version of libxml2 installed,
nor a version of libxslt. So I went ahead and installed my own via
these commands:

mkdir libxml2
cd libxml2

wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
tar -zxf libxml2-2.7.6.tar.gz
cd libxml2-2.7.6
./configure --prefix=$HOME/local/ --exec-prefix=$HOME/local
make
make install
cd ..


wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
tar -zxf libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=$HOME/local/ --exec-prefix=$HOME/local --with-
libxml-libs-prefix=$HOME/local --with-libxml-include-prefix=$HOME/
local --with-libxml-prefix=$HOME/local
make
make install

gem install nokogiri -- --with-xslt-dir=$HOME/local --with-xml2-dir=
$HOME/local



The output I get is:


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-dir=/home/dahjelle/local --
with-xml2-dir=/home/dahjelle/local
checking for iconv.h in /home/dahjelle/local/include,/home/dahjelle/
local/include,/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/dahjelle/local/include,/home/
dahjelle/local/include,/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/dahjelle/local/include,/home/
dahjelle/local/include,/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/dahjelle/local/include,/home/
dahjelle/local/include,/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'
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.



Yet even using nm on the libxslt.so file shows that the
xsltParseStylesheetDoc function exists, so it is rather unclear what
is going on.

The mkmf.log shows:

find_library: checking for xsltParseStylesheetDoc() in lxslt...
-------------------- no

"cc -o conftest -I/home/dahjelle/local/include -I/usr/include/libxml2 -
I/usr/include -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/home/me/
local/include -I/opt/local/include -fno-strict-aliasing -g -g -O2 -
fPIC -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -
Wconversion -Wmissing-noreturn -Winline conftest.c -L. -L/usr/lib -L/
home/me/local/lib -L/opt/local/lib -L. -rdynamic -Wl,-export-
dynamic -lxml2 -lruby1.8-static -lxslt -lxml2 -lpthread -ldl -
lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:3: error: ‘xsltParseStylesheetDoc’ undeclared (first use in
this function)
conftest.c:3: error: (Each undeclared identifier is reported only
once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))
xsltParseStylesheetDoc; return 0; }
/* end */


Which doesn't help a lot more. It almost looks like I'm not making the
right specifications in the gem install command, but no other
combinations I've tired have worked, either.

It complicates things that libxml2 is installed on Dreamhost, but as
an outdated version.

Any suggestions or help are greatly appreciated.

David

Aaron Patterson

unread,
Nov 16, 2009, 12:25:42 PM11/16/09
to nokogi...@googlegroups.com
On Sun, Nov 15, 2009 at 6:51 PM, David Alan Hjelle <dahj...@gmail.com> wrote:
>
> Hi!
>
> While I realize that many will say "use a different host," well, I
> could. I'm just nearly done with this project and using nokogiri on an
> optional feature, so my easiest solution is to just drop it. Before I
> do that, however, I wanted to give the wisdom of the list a try.

I have dreamhost too. I gave it a try and got it to work. Here are my steps:

$ wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
$ wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
$ tar zxvf libxml2-2.7.6.tar.gz
$ cd libxml2-2.7.6
$ ./configure --prefix=$HOME/local/ --exec-prefix=$HOME/local
$ make && make install
$ cd ..
$ tar zxvf libxslt-1.1.26.tar.gz
$ cd libxslt-1.1.26
$ ./configure --prefix=$HOME/local/ --with-libxml-prefix=$HOME/local/
$ make && make install
$ export LD_LIBRARY_PATH=$HOME/local/lib
$ gem install nokogiri -- --with-xslt-dir=$HOME/local \
--with-xml2-include=$HOME/local/include/libxml2 \
--with-xml2-lib=$HOME/local/lib

Setting the LD_LIBRARY_PATH is important. You should probably modify
your bashrc to set that whenever you log in (if you haven't already).
Also, you might get a couple warnings on install, but those are just
from an older version of RDoc.

Make sure to run "nokogiri -v" after installing to make sure
everything is set up correctly. The output should look like this:

$ nokogiri -v
---
warnings: []

libxml:
loaded: 2.7.6
binding: extension
compiled: 2.7.6
nokogiri: 1.4.0

Hope that helps.

--
Aaron Patterson
http://tenderlovemaking.com/

David Alan Hjelle

unread,
Nov 16, 2009, 10:38:44 PM11/16/09
to nokogiri-talk
Thanks!

Unfortunately, I followed your instructions exactly, twice, and still
get the same error:

checking for xsltParseStylesheetDoc() in -lxslt... no
libxslt is missing. try 'port install libxslt' or 'yum install
libxslt-devel'

I'm wondering if, perhaps, it is something in my gems configuration.
I'm currently using DH's installed gems program and installing gems to
a local directory, i.e.

$ which gem
/usr/bin/gem
$ echo $GEM_PATH
/home/username/.gems:/usr/lib/ruby/gems/1.8
$ gem -v
1.3.5

Do I need to compile and use my own gem command? Or is there another
environment variable (besides the LD_LIBRARY_PATH) that I might be
missing?

Thanks again!

David Alan Hjelle
1 Corinthians 2:2
http://thehjellejar.com


On Nov 16, 11:25 am, Aaron Patterson <aaron.patter...@gmail.com>
wrote:
> On Sun, Nov 15, 2009 at 6:51 PM, David Alan Hjelle <dahje...@gmail.com> wrote:
>
>
>
> > Hi!
>
> > While I realize that many will say "use a different host," well, I
> > could. I'm just nearly done with this project and using nokogiri on an
> > optional feature, so my easiest solution is to just drop it. Before I
> > do that, however, I wanted to give the wisdom of the list a try.
>
> I have dreamhost too.  I gave it a try and got it to work.  Here are my steps:
>
>   $ wgetftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
>   $ wgetftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz

Aaron Patterson

unread,
Nov 16, 2009, 10:52:47 PM11/16/09
to nokogi...@googlegroups.com
On Mon, Nov 16, 2009 at 7:38 PM, David Alan Hjelle <dahj...@gmail.com> wrote:
> Thanks!
>
> Unfortunately, I followed your instructions exactly, twice, and still
> get the same error:
>
> checking for xsltParseStylesheetDoc() in -lxslt... no
> libxslt is missing.  try 'port install libxslt' or 'yum install
> libxslt-devel'
>
> I'm wondering if, perhaps, it is something in my gems configuration.
> I'm currently using DH's installed gems program and installing gems to
> a local directory, i.e.
>
> $ which gem
> /usr/bin/gem
> $ echo $GEM_PATH
> /home/username/.gems:/usr/lib/ruby/gems/1.8
> $ gem -v
> 1.3.5

Hmmm. That is nearly what I have too:

$ which gem
/usr/bin/gem
[legs]$ echo $GEM_PATH
/usr/lib/ruby/gems/1.8:/home/username/.gems
$ gem -v
1.3.5
$

> Do I need to compile and use my own gem command? Or is there another
> environment variable (besides the LD_LIBRARY_PATH) that I might be
> missing?

I'm not sure... The first gem install command you sent didn't have
the right arguments. Did you use all of the switches I used?

David Alan Hjelle

unread,
Nov 16, 2009, 11:22:55 PM11/16/09
to nokogiri-talk
On Nov 16, 9:52 pm, Aaron Patterson <aaron.patter...@gmail.com> wrote:
>
> Hmmm.  That is nearly what I have too:
>
> $ which gem
> /usr/bin/gem
> [legs]$ echo $GEM_PATH
> /usr/lib/ruby/gems/1.8:/home/username/.gems
> $ gem -v
> 1.3.5
> $
>
> > Do I need to compile and use my own gem command? Or is there another
> > environment variable (besides the LD_LIBRARY_PATH) that I might be
> > missing?
>
> I'm not sure...  The first gem install command you sent didn't have
> the right arguments.  Did you use all of the switches I used?

Yes, I made sure of that. I copied each line directly from your email
(after the $, of course), removed the line breaks and continuation
characters (for the multiple-line command), and pasted it into a
terminal. (Since obviously a mistyped path wouldn't give an error
message, I didn't want to make any typing mistakes.)

Just now I tried reversing my GEM_PATH on the off chance that had
something to do with it. As expected, it didn't.

It seems very strange to me that the install seems to find libxml2 and
functions in that library without a problem. As far as I can tell from
looking at extconf.rb (not being a Rubyist), the output lines

checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... no

correspond to nearly identical function calls. I'm far from opposed to
hacking around in code, but I don't know enough Ruby to have a good
idea of where to start.

The mkmf.log still shows:

find_library: checking for xsltParseStylesheetDoc() in -lxslt...
-------------------- no

"cc -o conftest -I/home/username/local/include -I/home/username/local/
include/libxml2 -I/usr/include -I. -I/usr/lib/ruby/1.8/x86_64-linux -
I. -I/home/username/local/include -I/home/username/local/include/
libxml2 -I/opt/local/include -fno-strict-aliasing -g -g -O2 -
fPIC -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -
Wconversion -Wmissing-noreturn -Winline conftest.c -L. -L/usr/lib -L/
home/username/local/lib -L/opt/local/lib -L. -rdynamic -Wl,-export-
dynamic -lxml2 -lruby1.8-static -lxslt -lxml2 -lpthread -ldl -
lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:3: error: ‘xsltParseStylesheetDoc’ undeclared (first use
inthis function)
conftest.c:3: error: (Each undeclared identifier is reported only
once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))
xsltParseStylesheetDoc; return 0; }
/* end */

It's as if the -lxslt flag can't actually find the location of the
libxslt library in ~/local. I guess I'm not enough of a C-compiler
guru, either, to see what isn't right.

Any other ideas? Otherwise, I'll just move on…

Thanks again for your help!

David Alan Hjelle

unread,
Nov 21, 2009, 11:17:10 AM11/21/09
to nokogiri-talk
I've played with this a bit more, and the source of the problem seems
to be this:

"cc -o conftest -I/home/dahjelle/local/include -I/home/dahjelle/local/
include/libxml2 -I/usr/include -I. -I/usr/lib/ruby/1.8/x86_64-linux -
I. -I/home/dahjelle/local/include -I/home/dahjelle/local/include/
libxml2 -I/opt/local/include -fno-strict-aliasing -g -g -O2 -
fPIC -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -
Wconversion -Wmissing-noreturn -Winline conftest.c -L. -L/usr/lib -L/
home/dahjelle/local/lib -L/opt/local/lib -L. -rdynamic -Wl,-export-
dynamic -lxml2 -lruby1.8-static -lxslt -lxml2 -lpthread -ldl -
lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:3: warning: implicit declaration of function
‘xsltParseStylesheetDoc’
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`xmlGetIntSubset@LIBXML2_2.4.30'
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`xmlFreeNode@LIBXML2_2.4.30'
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`xmlNewDocNodeEatName@LIBXML2_2.4.30'
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`xmlValidateNCName@LIBXML2_2.5.4'
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`xmlDocSetRootElement@LIBXML2_2.4.30'
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`htmlNewDocNoDtD@LIBXML2_2.4.30'
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`xmlXPathNewNodeSet@LIBXML2_2.4.30'
.... sections removed for brevity....
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`xmlOutputBufferFlush@LIBXML2_2.4.30'
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`xmlXPathConvertString@LIBXML2_2.4.30'
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`xmlXPathNewValueTree@LIBXML2_2.4.30'
/home/dahjelle/local/lib/libxslt.so: undefined reference to
`xmlXPathNsLookup@LIBXML2_2.4.30'
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { xsltParseStylesheetDoc(); return 0; }
/* end */


You'll notice in the cc command the switch -L/usr/lib comes before the
-L switches including my locally installed libraries. If I created my
own conftest.c file and tried to compile it with the same command, I
get the same error.

However, if I remove the -L/usr/lib switch from the compile command,
all of the undefined reference errors disappear. I expect that's the
error.

However, I can't figure out the proper switch to pass to gem install
to make sure /usr/lib isn't included, or, at least, demoted in
priority. I've tried --without-opt-dir, --without-xml2-dir, --without-
xml2-lib, --without-xslt-lib, and more.

I even tried editing the included directories in extconf.rb, but that
didn't seem to help. Is /usr/lib included by default in the system
somewhere else?

Am I on the right track here?

David Alan Hjelle
http://thehjellejar.com

genexp

unread,
Jan 7, 2010, 8:06:16 PM1/7/10
to nokogiri-talk
Hey Folks -

I was wondering if you made any progress here; I'm having the same
issue and after a few hours I haven't made much progress.

Cheers

On Nov 21 2009, 11:17 am, David Alan Hjelle <dahje...@gmail.com>

Reply all
Reply to author
Forward
0 new messages