Ruby 1.8.7:找不到符号错误
刚刚在带有新宝石集的机器上全新安装了 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 技术交流群。
发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
这就是我为了让它在 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.