我很困惑。这对我来说是一种常态,但特别是在这种情况下,我觉得我可以联系到 stackoverflowers 的同伴(也就是说,stackoverflow-ers,而不是 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
...
我在重建一些原生红宝石宝石时做噩梦,我想知道这是否是问题的一部分——这台机器的一部分说它是 64 位,而另一部分是 32 位……据我所知?
在“关于此 Mac”下,它显示“Intel Core 2 Duo”,Apple 称其为 64 位。那么为什么,在做了之后
sudo gem pristine --all
我仍然收到这种错误吗?
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
具体来说,我已经删除了 nokogiri 并重新安装了它。输出没有错误。
bash-3.2$ sudo gem install nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.4.2
1 gem installed
感谢您的任何想法!
更新
我发现了Chris Noos关于类似问题的有用帖子。这就是我所在的位置:
cd /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.2/
然后制作了一个名为 wem_extconf.rb 的文件:
require 'mkmf'
find_library('xml2', 'xmlParseDoc')
dir_config('any-string-here', '/opt/local/include', '/opt/local/lib')
find_library('xml2', 'xmlParseDoc')
运行sudo web_extconf.rb
产生
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -lxml2... no
???但是等一下,它就在那里:
$ 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
看起来我确实有几个副本——但不确定安装的是哪个端口(我假设它是 macports,它是 /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