nokogiri 1.6.1 not working with ruby 2.0 and mavericks

358 views
Skip to first unread message

David Byron

unread,
Mar 1, 2014, 6:29:57 PM3/1/14
to nokogi...@googlegroups.com
I thought for sure now that libxml2 and libxslt are packaged with nokogiri that this problem (and http://nokogiri.org/tutorials/installing_nokogiri.html, http://dreamconception.com/tech/fix-nokogiri-install-issue-on-mac-os-x-10-9/ and https://github.com/sparklemotion/nokogiri/issues/742) was a thing of the past.  But, here I am, unable to get nokogiri to work.  This same code worked on an old machine of mine, and on a coworkers...so I think I'm dealing with an installation issue, but at this point I'm not sure.

Here are the details that I think are relevant:

$ bundle exec nokogiri -v
# Nokogiri (1.6.1)
    ---
    warnings: []
    nokogiri: 1.6.1
    ruby:
      version: 2.0.0
      platform: x86_64-darwin13.1.0
      description: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.1.0]
      engine: ruby
    libxml:
      binding: extension
      source: packaged
      libxml2_path: /Users/david.byron/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.1.0/libxml2/2.8.0
      libxslt_path: /Users/david.byron/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.1.0/libxslt/1.1.26
      compiled: 2.8.0
      loaded: 2.8.0

$ bundle exec rails console
Loading development environment (Rails 3.2.17)

Frame number: 0/3
[1] pry(main)> load 'nokogiri_install_hell.rb'
[]
=> true

Here's a snippet from the dynamic library info from invoking the previous command with DYLD_PRINT_LIBRARIES=1:

dyld: loaded: /Users/david.byron/.rvm/gems/ruby-2.0.0-p247/extensions/x86_64-darwin-13/2.0.0/nokogiri-1.6.1/nokogiri/nokogiri.bundle
dyld: loaded: /Users/david.byron/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.1.0/libxslt/1.1.26/lib/libexslt.0.dylib
dyld: loaded: /Users/david.byron/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.1.0/libxslt/1.1.26/lib/libxslt.1.dylib
dyld: loaded: /Users/david.byron/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.1.0/libxml2/2.8.0/lib/libxml2.2.dylib
dyld: loaded: /usr/lib/libiconv.2.dylib

$ ls -l /usr/lib/libiconv.*
lrwxr-xr-x  1 root  wheel       16 Nov 15 12:23 /usr/lib/libiconv.2.4.0.dylib -> libiconv.2.dylib
-r-xr-xr-x  1 root  wheel  2088992 Nov 15 12:22 /usr/lib/libiconv.2.dylib
lrwxr-xr-x  1 root  wheel       20 Nov 15 12:23 /usr/lib/libiconv.dylib -> libiconv.2.4.0.dylib

And just in case:

$ brew list libxml2
Error: No such keg: /usr/local/Cellar/libxml2
$ brew list libxslt
Error: No such keg: /usr/local/Cellar/libxslt

I would be most grateful if someone could take a look and give me a hand.  If there is more info about my system I need to provide to work this out, please let me know.

Thanks much.

-DB

nokogiri_install_hell.rb

David Byron

unread,
Mar 3, 2014, 1:09:37 PM3/3/14
to nokogi...@googlegroups.com
If it's somehow interesting, the libxml test program here: http://xmlsoft.org/examples/xpath1.c, compiles, links and runs fine:

$ gcc xpath1.c -I ~/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.1.0/libxml2/2.8.0/include/libxml2/ -L ~/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.1.0/libxml2/2.8.0/lib -lxml2

$ ./a.out test.xml "//soap_body"

where test.xml contains the same thing embedded in the ruby example I attached before:

<soap_body>
  <resource_id>custom_resource_id</resource_id>
</soap_body>

This tells me that the libxml2 that nokogiri uses is working properly.  Does this light a lightbulb for someone as to what's going on?

Thanks much.

-DB

PS

$ which gcc
/usr/bin/gcc
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
Reply all
Reply to author
Forward
0 new messages