Ruby 1.8.7:找不到符号错误

发布于 12-11 23:44 字数 1008 浏览 1 评论 0原文

刚刚在带有新宝石集的机器上全新安装了 ruby​​ 1.8.7 REE 和 MRI(使用 RVM)但是在每个机器上,当我尝试使用 memprof 时,我收到此错误

$ gem install memprof
$ irb
>> require 'rubygems'
>> require 'memprof'
>> LoadError: dlopen(/Users/schneems/.rvm/gems/ruby-1.8.7-p352@test/gems/memprof-0.3.10/lib/memprof.bundle, 9): Symbol not found: __mh_bundle_header
  Referenced from: /Users/schneems/.rvm/gems/ruby-1.8.7-p352@test/gems/memprof-0.3.10/lib/memprof.bundle
  Expected in: flat namespace
 in /Users/schneems/.rvm/gems/ruby-1.8.7-p352@test/gems/memprof-0.3.10/lib/memprof.bundle - /Users/schneems/.rvm/gems/ruby-1.8.7-p352@test/gems/memprof-0.3.10/lib/memprof.bundle
    from /Users/schneems/.rvm/gems/ruby-1.8.7-p352@test/gems/memprof-0.3.10/lib/memprof.bundle
    from /Users/schneems/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `require'
    from (irb):2

错误是 Symbol not find: __mh_bundle_header。我的问题是:我需要做什么才能让我的系统找到这个符号,或者我还需要安装其他东西吗?欢迎任何调试建议。

Just did a fresh install of ruby 1.8.7 REE and MRI on a machine with fresh gem sets (Using RVM) Yet in each of them when I try to use memprof i get this error

$ gem install memprof
$ irb
>> require 'rubygems'
>> require 'memprof'
>> LoadError: dlopen(/Users/schneems/.rvm/gems/ruby-1.8.7-p352@test/gems/memprof-0.3.10/lib/memprof.bundle, 9): Symbol not found: __mh_bundle_header
  Referenced from: /Users/schneems/.rvm/gems/ruby-1.8.7-p352@test/gems/memprof-0.3.10/lib/memprof.bundle
  Expected in: flat namespace
 in /Users/schneems/.rvm/gems/ruby-1.8.7-p352@test/gems/memprof-0.3.10/lib/memprof.bundle - /Users/schneems/.rvm/gems/ruby-1.8.7-p352@test/gems/memprof-0.3.10/lib/memprof.bundle
    from /Users/schneems/.rvm/gems/ruby-1.8.7-p352@test/gems/memprof-0.3.10/lib/memprof.bundle
    from /Users/schneems/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `require'
    from (irb):2

The error is Symbol not found: __mh_bundle_header. My question is this: what do i need to do to get my system to find this symbol, or is there something else I need to install? Any debugging suggestions welcomed.

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

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

发布评论

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

评论(2

微暖i2024-12-18 23:44:51

这就是我为了让它在 Snow Leopard 上工作而所做的:

cd ..../gems/memprof-0.3.10/ext/

编辑 Makefile,搜索 LD_SHARED=

Change from

LDSHARED = cc -arch x86_64 -dynamiclib -undefined 抑制 -flat_namespace

LDSHARED = cc -arch x86_64 -bundle -bundle_loader $(RUBY) -undefined suggest -flat_namespace

(用 -bundle 和 -bundleloader 选项替换 -dynamiclib)

然后,

make install (创建 memprof.bundle 并将其复制到 memprof*/lib )

编辑:为了澄清, $(RUBY) 必须包含 ruby​​ 解释器(可执行文件)的完整路径名。在 RVM 下,Makefile 将其初始化为适当的解释器,因此上面的行可以正常工作。

This is what I did to get it to work on Snow Leopard:

cd ..../gems/memprof-0.3.10/ext/

Edit Makefile, search for LD_SHARED=

Change from

LDSHARED = cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace

to

LDSHARED = cc -arch x86_64 -bundle -bundle_loader $(RUBY) -undefined suppress -flat_namespace

(replaced -dynamiclib with -bundle and -bundleloader options)

Then,

make install (which creates memprof.bundle and copies it to memprof*/lib)

Edit: Just to clarify, $(RUBY) must contain the full pathname to the ruby interpreter (the executable). Under RVM, the Makefile initializes it to the appropriate interpreter, so the above line works without a problem.

多孤肩上扛2024-12-18 23:44:51

看起来它没有正确编译,并且缺少捆绑库的链接器标志。尝试构建它是 LDFLAGS="-bundle"...我不确定你如何使用 RVM 来做到这一点,但我假设它会继承你给它的环境。

编辑|抱歉,正确的 ld 标志可能是:LDFLAGS="-bundler_loader"
编辑2 |实际上,我不确定它是 bundle 还是 bundle_loader...我在 Google 结果中看到了两者。

Looks like it was not compiled correctly and was missing the linker flags for the bundle library. Try building it was LDFLAGS="-bundle"... I'm not sure how you do that with RVM, but I assume it will inherit the environment you give it.

EDIT | Sorry, looks like the correct ld flag may be: LDFLAGS="-bundler_loader"
EDIT 2 | Actually, I'm not sure if it's bundle or bundle_loader... I'm seeing both in Google results.

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