tags:

views:

48

answers:

1

I successfully installed the yajl-ruby rubygem via gem install, yet attempting to use it throws this error:

/usr/local/lib/ruby/gems/1.8/gems/yajl-ruby-0.7.7/lib/yajl_ext.bundle: dlopen(/usr/local/lib/ruby/gems/1.8/gems/yajl-ruby-0.7.7/lib/yajl_ext.bundle, 9): no suitable image found.  Did find: (LoadError)
/usr/local/lib/ruby/gems/1.8/gems/yajl-ruby-0.7.7/lib/yajl_ext.bundle: mach-o, but wrong architecture - /usr/local/lib/ruby/gems/1.8/gems/yajl-ruby-0.7.7/lib/yajl_ext.bundle

I'm guessing it's an architecture mismatch somewhere, but can't figure out why and how to fix it. The machine has a 32 bit kernel, and I installed ruby to /usr/local/src via the hivelogic instructions.

Running a lipo -info on the ruby binary gives: "Architectures in the fat file: /usr/bin/ruby are: x86_64 i386 ppc7400", and I tried forcing yajl-ruby to install via both 32 bit/64 bit architectures by doing "sudo env ARCHFLAGS="-arch x86_64" gem install yajl-ruby" and the same with "ARCHFLAGS="-arch i386".

Figured I'd ask on SO first before approaching the author to make sure it's not an issue with my setup.

A: 

I had a similar issue. It happened after upgrading to Snow Leopard (64bit) from Leopard (32bit). What solved it for me was to compile and install Ruby all over again.

If you're on OS/X, you can use this guide: http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard .

arikfr
Thanks - Yea, I attempted doing that (which fixed some problems) but some gems still won't work. Perhaps, there are files laying around from the first install that aren't getting cleaned up/overwritten?
jeffthink
On the official Rails blog they have instructions on how to update all gems. Maybe you should try that. I first updated all Gems and then rebuilt Ruby, but I don't think the order is of any significance.
arikfr