Installation fails on FreeBSD 10.2 and Ruby 2.3.0

88 views
Skip to first unread message

Flackou

unread,
Jan 23, 2016, 4:06:22 PM1/23/16
to nokogiri-talk
Hi everybody,

I had a problem when trying to install Nokogiri (latest version) on FreeBSD 10.2 and Ruby 2.3.0 : the `gem install` complains about "libxml2 version 2.6.21 or later is required!" but I have libxml2 version 2.9.2 installed (as seen in /usr/local/include/libxml2/libxml/xmlversion.h file)... I did use the command given in the installation guide, with lib locations (cf http://www.nokogiri.org/tutorials/installing_nokogiri.html#freebsd). This seems to be specific to Ruby 2.3.0 because I could install it on Ruby 2.1.5.

The log of my commands is attached to this message (install_nokogiri.log), as well as the 2 output files mkmf.log and gem_make.out.

The error can be reproduced using this Vagrant box : https://atlas.hashicorp.com/freebsd/boxes/FreeBSD-10.2-RELEASE

I don't know much thing about compilation so I'm asking for help ! Can you see where is the problem ?

Thanks in advance,

Julien
install_nokogiri.log
gem_make.out
mkmf.log

Mike Dalessio

unread,
Jan 23, 2016, 8:51:17 PM1/23/16
to nokogiri-talk
I'm able to reproduce this problem with Ruby 2.3.0, 2.2.4, and 2.1.5 on FreeBSD 10.2.

Your email claims that you can get Ruby 2.1.5 to work -- can you share details about how you reached this conclusion?

I need to investigate a bit more.


--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-tal...@googlegroups.com.
To post to this group, send email to nokogi...@googlegroups.com.
Visit this group at https://groups.google.com/group/nokogiri-talk.
For more options, visit https://groups.google.com/d/optout.

Mike Dalessio

unread,
Jan 23, 2016, 9:39:38 PM1/23/16
to nokogiri-talk
Ah, I figured it out. This is the command that's documented, and that you ran:

gem install nokogiri -- \
    --use-system-libraries \
    --with-xml2-lib=/usr/local/lib \
    --with-xml2-include=/usr/local/include/libxml2/libxml \
    --with-xslt-lib=/usr/local/lib \
    --with-xslt-include=/usr/local/include/libxslt \
    --with-iconv-lib=/usr/local/lib \
    --with-iconv-include=/usr/local/include

but this is what it should be:

gem install nokogiri -- \
    --use-system-libraries \
    --with-xml2-lib=/usr/local/lib \
    --with-xml2-include=/usr/local/include/libxml2 \
    --with-xslt-lib=/usr/local/lib \
    --with-xslt-include=/usr/local/include/libxslt \
    --with-iconv-lib=/usr/local/lib \
    --with-iconv-include=/usr/local/include

note the difference in the `--with-xml2-include` value.

Mike Dalessio

unread,
Jan 23, 2016, 10:03:39 PM1/23/16
to nokogiri-talk
Please note this problem goes away entirely if you have `pkgconf` installed on FreeBSD.

That is, if you have run

    sudo pkg install pkgconf

then running

    gem install nokogiri -- --use-system-libraries

will Just Work™.

I'll update the installation tutorial with this information.

Flackou

unread,
Jan 25, 2016, 5:16:33 PM1/25/16
to nokogiri-talk
Thanks for your help but in fact there was another change needed in the paths : "--with-xslt-include=/usr/local/include" (instead of " --with-xslt-include=/usr/local/include/libxslt").

So in the end, the correct command is :


gem install nokogiri -- \
    --use-system-libraries \
    --with-xml2-lib=/usr/local/lib \
    --with-xml2-include=/usr/local/include/libxml2 \
    --with-xslt-lib=/usr/local/lib \
    --with-xslt-include=/usr/local/include \
    --with-iconv-lib=/usr/local/lib \
    --with-iconv-include=/usr/local/include

Thanks again !

Julien

Mike Dalessio

unread,
Jan 25, 2016, 6:05:51 PM1/25/16
to nokogiri-talk
OK, but once again, none of that is necessary if you've installed `pkgconf`. That's my recommendation, and what I've put into the installation tutorial for future readers.

Flackou

unread,
Jan 26, 2016, 3:55:39 AM1/26/16
to nokogiri-talk
Yes indeed but sometimes it's simpler if you don't need sudo :-) 

Thanks again Mike, problem solved !
Reply all
Reply to author
Forward
0 new messages