Flethuseo
Flethuseo

Reputation: 6199

Help installing nokogiri with new libxml2

I am getting the following error in nokogiri. I am installing the new library of libxml2 via fink, when I type "fink list libxml2" I get:

i   libxml2          2.7.8-102    XML parsing library, version 2

I have also added to my .Profile to the DY_LIBRARY_PATH ... /sw/lib , when I try to run my program I get the following warning:

WARNING: Nokogiri was built against LibXML version 2.6.16, but has dynamically loaded 2.7.8

How can I install that gem so that it links against the newer libxml2 library? I install the gem as:

sudo gem install nokogiri

Ted

Upvotes: 0

Views: 415

Answers (3)

Aleks N.
Aleks N.

Reputation: 6247

The source of the troubles is sudo. nokogiri installs really easily without any custom flags if you run it on a properly configured environment. Details in a similar thread: https://stackoverflow.com/a/30603620/145046

Upvotes: 0

the Tin Man
the Tin Man

Reputation: 160581

You have read "Nonstandard libxml2 / libxslt installations" right?

Fink is a non-standard install on Mac OS.

Per the Nokogiri Installation docs:

If you’ve got libxml2 and/or libxslt installed in a nonstandard place (read as “not /opt/local, /usr/local, /usr or the standard Ruby directories”), you can use command-line parameters to the gem install command to grease the wheels:

gem install nokogiri -- --with-xml2-dir=/home/joe/builds \
                        --with-xslt-dir=/home/joe/builds

Or, you can specify include and library directories separately:

gem install nokogiri -- --with-xml2-lib=/home/joe/builds/lib \
                        --with-xml2-include=/home/joe/builds/include/libxml2 \
                        --with-xslt-lib=/home/joe/builds/lib \
                        --with-xslt-include=/home/joe/builds/include

Note that, by default, libxslt header files are installed into the root include directory, but libxml2 header files are installed into a subdirectory thereof named libxml2.

Upvotes: 1

Vasiliy Ermolovich
Vasiliy Ermolovich

Reputation: 24617

From nokogiri wiki:

Specify the libxml2 and libxslt dirs for the installer. If you’re using fink:

gem install nokogiri -- --with-xml2-include=/sw/include/libxml2 --with-xml2-lib=/sw/lib --with-xslt-dir=/sw

Upvotes: 0

Related Questions