我使用VirtualBox和Ubuntu服务器12.04 LTS的最新图像为Vagrant创建了一个基本框。
安装所有更新,build-essential,libffi-dev等
我已经安装了rvm和ruby 1.9.3-p484(这是必需的版本)。
当我尝试通过gem install ffi
安装ffi gem时,我得到:
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby extconf.rb
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
checking for rb_thread_blocking_region()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... yes
creating extconf.h
creating Makefile
make clean
make
compiling Types.c
compiling MethodHandle.c
compiling MappedType.c
compiling Function.c
Function.c: In function ‘callback_invoke’:
Function.c:479:9: warning: passing argument 1 of ‘rb_thread_call_with_gvl’ from incompatible pointer type [enabled by default]
Function.c:102:14: note: expected ‘void * (*)(void *)’ but argument is of type ‘VALUE (*)(void *)’
compiling Struct.c
compiling Type.c
compiling MemoryPointer.c
compiling Pointer.c
compiling DynamicLibrary.c
DynamicLibrary.c: In function ‘library_initialize’:
DynamicLibrary.c:127:23: error: ‘RTLD_LAZY’ undeclared (first use in this function)
DynamicLibrary.c:127:23: note: each undeclared identifier is reported only once for each function it appears in
DynamicLibrary.c: In function ‘rbffi_DynamicLibrary_Init’:
DynamicLibrary.c:327:5: error: ‘RTLD_LAZY’ undeclared (first use in this function)
DynamicLibrary.c:328:5: error: ‘RTLD_NOW’ undeclared (first use in this function)
DynamicLibrary.c:329:5: error: ‘RTLD_GLOBAL’ undeclared (first use in this function)
make: *** [DynamicLibrary.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p484@somegemset/gems/ffi-1.9.3 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p484@somegemset/extensions/x86_64-linux/1.9.1/ffi-1.9.3/gem_make.out
我似乎无法找到有关此错误的任何信息。我猜测我错过了一个明显的包装,但我真的不确定它是什么。
非常感谢我能帮助你解决这个问题。