我发现ruby-llvm使用llvm 3.5(https://rubygems.org/gems/ruby-llvm/versions/3.5.0),所以我尝试使用llvm-ruby / llvm 3.5。
我使用brew install llvm35 --shared
安装了LLVM,并检查了llvm是否正常工作,并且安装了库。然后,我用gem install ruby-llvm
安装了ruby-llvm。
然而,当我尝试使用(https://github.com/ruby-llvm/ruby-llvm)中的示例程序时,我遇到了错误,当我拥有llvm库时/usr/local/Cellar/llvm35/3.5.1/lib/llvm-3.5/lib/libLLVM-3.5.dylib
dlopen(libLLVM-3.5.so.1, 5): image not found. (LoadError)
Could not open library 'libLLVM-3.5.so.1.dylib': dlopen(libLLVM-3.5.so.1.dylib, 5): image not found.
Could not open library 'LLVM-3.5': dlopen(LLVM-3.5, 5): image not found.
Could not open library 'libLLVM-3.5.dylib': dlopen(libLLVM-3.5.dylib, 5): image not found
from /Users/smcho/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/ffi-1.9.10/lib/ffi/library.rb:100:in `map'
from /Users/smcho/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/ffi-1.9.10/lib/ffi/library.rb:100:in `ffi_lib'
from /Users/smcho/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/ruby-llvm-3.5.0/lib/llvm/core_ffi.rb:7:in `<module:C>'
from /Users/smcho/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/ruby-llvm-3.5.0/lib/llvm/core_ffi.rb:5:in `<top (required)>'
from /Users/smcho/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/smcho/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
可能有什么问题?我设置export LD_LIBRARY_PATH=/usr/local/Cellar/llvm35/3.5.1/lib
,但我仍然有同样的错误。