Installing nokogiri with --use-system-libraries (was: Re: Migrating the guide to AsciiDoc)

Rainer Müller raimue at macports.org
Mon Apr 23 22:23:54 UTC 2018


On 2018-04-23 20:35, Andrew Moore wrote:
> You might try:
> 
> $ sudo gem update —system
> 
> which should install the latest version of bundler (you really want that), and go from there.
> In the particular case of nokogiri, you might also try running `gem install nokogiri` as user root.

I am very cautious about running third-party package managers as root
and let them write to ${prefix}. That is supposed to be managed by
MacPorts and no other package manager should update files.

If this overwrites any file provided by the ruby port, just running
a deactivate/activate cycle will bring back the old version. Or an
inconsistent state, if it also wrote new files to keep the version
information.

If there is ever going to be a rb23-nokogiri port, I expect this to
cause conflicts later with files not known to MacPorts.

When I uninstall the ruby port, this might leave traces behind
in ${prefix} that can be cleaned up, but I would not be aware of that.

nokogiri uses vendored versions of zlib/libxml2/libxslt and other
dependencies by default. I already have them installed in ${prefix}
and I do not want to build them again from source, therefore I used
--use-system-libraries (as the README of docbookrx suggested).

I even dared to give this a try as root (again, not recommended),
but this also fails in the same way:

$ sudo gem2.5 install nokogiri -- --use-system-libraries
...
pkg-config could not be used to find libxml-2.0
...

>From .../mkmf.log:

"pkg-config --exists libxml-2.0"
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /opt/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
package configuration for libxml-2.0 is not found

This pkg-config command works fine outside of 'gem install'.

The crash report in Console.log shows that the invocation of pkg-config
included the environment variable: DYLD_LIBRARY_PATH=.:/opt/local/lib

Rainer


More information about the macports-dev mailing list