If you have this problem:
HI. You're using libxml2 version 2.6.16 which is over 4 years old and has
plenty of bugs. We suggest that for maximum HTML/XML parsing pleasure, you
upgrade your version of libxml2 and re-install nokogiri. If you like using
libxml2 version 2.6.16, but don't like this warning, please define the constant
I_KNOW_I_AM_USING_AN_OLD_AND_BUGGY_VERSION_OF_LIBXML2 before requring nokogiri.
Here is the solution:
Install the latest libxml2 and libxslt
Make a source directory somewhere and do the following commands to grab the latest versions of libxml2 and libxslt:
$ curl -O ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz
$ curl -O ftp://xmlsoft.org/libxml2/libxslt-1.1.24.tar.gz
Once done, unpack both like so:
$ tar xzf libxml2-2.7.3.tar.gz
$ tar xzf libxslt-1.1.24.tar.gz
Now change into the libxml directory and build it:
$ ./configure
$ make
$ sudo make install
Now jump back to the libxslt directory and do the same:
$ cd ../libxslt-1.1.24
$ ./configure
$ make
$ sudo make install
If you want, go ahead and delete the sources to save space. Now you’re ready for the final step.
Install Nokogiri
Now installing Nokogiri is super easy once we tell it where to link.
$ sudo gem install nokogiri -- --with-xml2-include=/usr/local/include/libxml2 --with-xml2-lib=/usr/local/lib
No comments:
Post a Comment