豹=>雪豹建筑与 nokogiri / 导轨的困境

发布于 2024-09-03 14:44:27 字数 2912 浏览 2 评论 0原文

我很困惑。这对我来说是一种常态,但特别是在这种情况下,我觉得我可以接触到其他 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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

香橙ぽ 2024-09-10 14:44:27

在 Snow Leopard 上,gcc 有误导行为;即使您运行的是 i386 内核,gcc 默认情况下也会生成 64 位二进制文​​件。

您是否查看过 GEM 文档以了解如何指定目标架构?

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 ?

何止钟意 2024-09-10 14:44:27

你安装了XCode开发工具了吗?

Have you installed the XCode Development tools?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文