views:

56

answers:

2

I'm confused. It's a regular state of affairs for me but specifically in this case I felt I could reach out to fellow stackoverflowers (that is, stackoverflow-ers, not stackover-flowers).

uname -a
Darwin macbookpro 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386

set

bash-3.2$ set
...
HOSTTYPE=x86_64
...
MACHTYPE=x86_64-apple-darwin10.0
...

I'm having a nightmare rebuilding some native ruby gems and I'm wondering whether this is part of the problem -- part of this machine says its 64 bit but another part 32 ... as far as I can tell?

Under 'About this Mac' it says 'Intel Core 2 Duo' which Apple says is 64 bit. So why, after doing

sudo gem pristine --all

am I still getting this kind of error?

dlopen(/Applications/Rails/ruby/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle, 9): no suitable image found.  Did find:
 /Applications/Rails/ruby/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle: mach-o, but wrong architecture - /Applications/Rails/ruby/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle

Specifically I had removed nokogiri and reinstalled it. No errors in output.

bash-3.2$ sudo gem install nokogiri
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.4.2
1 gem installed

thanks for any thoughts!

UPDATE

I've found a useful post by Chris Noos on a similar problem. This is where I am:

cd /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/

then made a file called wem_extconf.rb:

require 'mkmf'
find_library('xml2', 'xmlParseDoc')
dir_config('any-string-here', '/opt/local/include', '/opt/local/lib')
find_library('xml2', 'xmlParseDoc')

Running sudo web_extconf.rb produces

checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -lxml2... no

???? But hang on, it is there:

$ port installed | grep libxml2.*active
libxml2 @2.7.7_0+universal (active)

$ ls -l /opt/local/lib | grep libxml2
-rwxr-xr-x   2 root  admin  2623276 31 May 20:09 libxml2.2.dylib
-rw-r--r--   2 root  admin  3643928 31 May 20:09 libxml2.a
lrwxr-xr-x   1 root  admin       15 31 May 20:09 libxml2.dylib -> libxml2.2.dylib
-rwxr-xr-x   2 root  admin      975 31 May 20:09 libxml2.la

And it does appear I have several copies of the thing -- but not sure which one port installed is using (I'm assuming given it's macports, it's /opt?)

$ ls -l /usr/lib | grep libxml2
lrwxr-xr-x    1 root  wheel        15 23 May 16:07 libxml2.2.7.3.dylib -> libxml2.2.dylib
-rwxr-xr-x    1 root  wheel   3758272 22 Sep  2009 libxml2.2.dylib
lrwxr-xr-x    1 root  wheel        15 23 May 16:07 libxml2.dylib -> libxml2.2.dylib

$ ls -l /usr/local/lib | grep libxml2
-rwxr-xr-x  1 root    admin  1456292 30 Oct  2009 libxml2.2.dylib
-rw-r--r--  1 root    admin  4812456 30 Oct  2009 libxml2.a
-rwxr-xr-x  1 root    admin  1456292 30 Oct  2009 libxml2.dylib
-rwxr-xr-x  1 root    admin      951 30 Oct  2009 libxml2.la
A: 

Have you installed the XCode Development tools?

Toby Hede
yes thanks Toby for asking -- I installed Xcode 3.2 (the Snow Leopard version).
Julian
+1  A: 

On Snow Leopard, gcc has a misleading behavior; even if you are running a i386 kernel, gcc will produce 64 bits binaries by default.

Have you looked at the GEM documentation to see how to specify the targeted architecture ?

Laurent Etiemble