Nokogiri error on snow leopard

hi,

below is the setup i have:
Mac OS X Snow Leopard
running ruby 1.8.7 installed using hivelogic procedure

installed libxml2 and libxslt from source
installed nokogiri 1.4.2 using sudo gems

EMercados-MacBook-Pro:~ ermercado$ gem list

*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
cgi_multipart_eof_fix (2.5.0)
cheat (1.2.1)
daemons (1.0.10)
eventmachine (0.12.10)
fastthread (1.0.7)
gem_plugin (0.2.3)
mongrel (1.1.5)
mysql (2.8.1)
nokogiri (1.4.2, 1.3.3)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
rspec (1.2.9)
rubygems-update (1.3.6)
sqlite3-ruby (1.2.5)
thin (1.2.4)

why am i getting the following message when i issue ‘require nokogiri’
on irb?

EMercados-MacBook-Pro:~ ermercado$ irb
irb(main):001:0> require ‘nokogiri’
LoadError:
dlopen(/usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle,
9): no suitable image found. Did find:
/usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle:
mach-o, but wrong architecture -
/usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle
from
/usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri.rb:13 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:ingem_original_require’
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require’
from (irb):1

even after issuing the below command:

EMercados-MacBook-Pro:~ ermercado$ export RUBYOPT=“rubygems”

thanks very much for your help
manny

i’ve upgraded ruby to 1.9.1, it’s working fine now.

hi,

‘No suitable image found’ error occurs if arch different between ruby
and library.

And snow leopard builds 64bit in default. but snow leopard’s ruby is
built in 32bit.

so i think build ruby yourself and reinstall gems.


Sora H. (iPad) - @sora_h
Blog: http://codnote.net
Prof: http://sorah.cosmio.net

On Jun 12, 2010, at 21:34 , Sora H. wrote:

‘No suitable image found’ error occurs if arch different between ruby
and library.

And snow leopard builds 64bit in default. but snow leopard’s ruby is
built in 32bit.

so i think build ruby yourself and reinstall gems.

again… stock ruby would have saved you pain:

Sorry for I missed that post.
hmm… I think bad is “universal binary”.

build ruby yourself to quickly make happy. :smiley:


Sora H. (iPad) - @sora_h
Blog: http://codnote.net
Prof: http://sorah.cosmio.net

On Jun 12, 2010, at 06:00 , Emmanuel Mercado wrote:

why am i getting the following message when i issue ‘require nokogiri’
on irb?

EMercados-MacBook-Pro:~ ermercado$ irb
irb(main):001:0> require ‘nokogiri’
LoadError:
dlopen(/usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle,

If you’re on snow leopard, then why not skip the hivelogic crap and use
stock everything? It Just Works™.

If not, then try otool to figure out what went wrong:

509 % otool -L
/Library/Ruby/Gems/1.8/gems/nokogiri-1.4.1/lib/nokogiri/nokogiri.bundle
/Library/Ruby/Gems/1.8/gems/nokogiri-1.4.1/lib/nokogiri/nokogiri.bundle:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib
(compatibility version 1.8.0, current version 1.8.7)
/usr/lib/libexslt.0.dylib (compatibility version 9.0.0, current
version 9.13.0)
/usr/lib/libxslt.1.dylib (compatibility version 3.0.0, current version
3.24.0)
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current
version 10.3.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.0.0)

thanks a lot! This sorted me out, though I’d like to add that my rails
apps up to 2.3.5 worked with passenger, but 2.3.8 and the new 3 beta4
didn’t
I changed to ruby 1.8.7-p174 which does the 64bit and voilà : beautiful
Thanks so much!!!
Daniela

On Jun 12, 2010, at 14:21, Ryan D. wrote:

[…]
If not, then try otool to figure out what went wrong:
If it’s an architecture problem, file might be better:

$ file which ruby
/usr/bin/ruby: Mach-O universal binary with 3 architectures
/usr/bin/ruby (for architecture x86_64): Mach-O 64-bit executable
x86_64
/usr/bin/ruby (for architecture i386): Mach-O executable i386
/usr/bin/ruby (for architecture ppc7400): Mach-O executable ppc

$ file gem which nokogiri/nokogiri
/Library/Ruby/Gems/1.8/gems/nokogiri-1.4.1/lib/nokogiri/nokogiri.bundle:
Mach-O 64-bit bundle x86_64

For me, nokogiri is probably x86_64 only because the libxml is x86_64
only:

$ port installed libxml2
The following ports are currently installed:
libxml2 @2.7.6_0 (active)

Here’s a universal variant:

$ port installed freeimage
The following ports are currently installed:
freeimage @3.13.1_0+universal (active)