在Mac上运行带有32位红宝石的64位dylib

时间:2012-09-05 02:16:23

标签: ruby 64-bit 32bit-64bit dynamic-library ruby-llvm

我正在尝试安装ruby-llvm

我可以使用brew install llvm -shared安装llvm,我也可以使用ruby-llvm命令安装sudo gem install ruby-llvm

但是,当我尝试运行examples时,我收到了这些错误消息。

/Users/smcho/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.1.5/lib/ffi/library.rb:121:in `block in ffi_lib': 
Could not open library '/DIR/.rvm/gems/ruby-1.9.3-p194/gems/ruby-llvm-3.0.0/lib/libRubyLLVMSupport-3.0.0.dylib': 
dlopen(/DIR/.rvm/gems/ruby-1.9.3-p194/gems/ruby-llvm-3.0.0/lib/libRubyLLVMSupport-3.0.0.dylib, 5): no suitable image found.  Did find: (LoadError)
/DIR/.rvm/gems/ruby-1.9.3-p194/gems/ruby-llvm-3.0.0/lib/libRubyLLVMSupport-3.0.0.dylib: mach-o, but wrong architecture

我检查过动态库是64位。

file /DIR/.rvm/gems/ruby-1.9.3-p194/gems/ruby-llvm-3.0.0/lib/libRubyLLVMSupport-3.0.0.dylib 
libRubyLLVMSupport-3.0.0.dylib: Mach-O 64-bit dynamically linked shared library x86_64

似乎ruby在32位模式下运行。 ruby 1.9.3p194 (2012-04-20 revision 35410) [i386-darwin11.4.0]

如何解决此问题?有没有办法下载32位版本的ruby-llvm或64位版本的ruby

1 个答案:

答案 0 :(得分:1)

好像你已经在32位模式下安装了ruby。在64位模式下安装ruby会解决问题吗?

要强制使用64位,您可以使用最新版本的RVM尝试以下操作:

$ rvm install 1.9.3 --64

或     $ rvm install 1.9.3 --with-arch = x86_64

(来自:http://www.engineyard.com/blog/2012/rvm-stable-and-more/

为了在OS X上编译32位模式ruby,我们有--32, - 64和--universal flags:

$ rvm install 1.9.3 --universal # to build fat binary including both 32 and 64 bit binaries
$ rvm install 1.8.7 --32 # to build only 32 bit ruby
$ rvm install 1.8.7 --with-arch=i386 # is equivalent to the 32 bit one, but is available only via RVM, ruby 1.8.7 sources do not support it.