Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 在OS X Mountain Lion上安装ffi gem时出错_Ruby_Rubygems_Gem_Rvm_Ffi - Fatal编程技术网

Ruby 在OS X Mountain Lion上安装ffi gem时出错

Ruby 在OS X Mountain Lion上安装ffi gem时出错,ruby,rubygems,gem,rvm,ffi,Ruby,Rubygems,Gem,Rvm,Ffi,我试图在我的OS X Mountain Lion上安装ffi gem(这样我就可以运行Octopress),但我遇到了错误 运行gem install ffi-v“1.0.11”将提供以下输出: /chetanshenoy.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb checking for ffi.h... no checking for ffi.h in /usr/local/include... no checking for rb_thr

我试图在我的OS X Mountain Lion上安装ffi gem(这样我就可以运行Octopress),但我遇到了错误

运行
gem install ffi-v“1.0.11”
将提供以下输出:

/chetanshenoy.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include... no
checking for rb_thread_blocking_region()... yes
checking for ruby_native_thread_p()... yes
checking for rb_thread_call_with_gvl()... yes
creating extconf.h
creating Makefile

make
Configuring libffi
/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/configure: line 642: test: too many arguments
/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/configure: line 642: test: too many arguments
configure: WARNING: Libtool does not cope well with whitespace in `pwd`
cd "/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi" && make
make "AR_FLAGS=" "CC_FOR_BUILD=" "CFLAGS=" "CXXFLAGS=" "CFLAGS_FOR_BUILD=" "CFLAGS_FOR_TARGET=" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c" "JC1FLAGS=" "LDFLAGS=" "LIBCFLAGS=" "LIBCFLAGS_FOR_TARGET=" "MAKE=make" "MAKEINFO=/bin/sh "/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/missing" --run makeinfo " "PICFLAG=" "PICFLAG_FOR_TARGET=" "RUNTESTFLAGS=" "SHELL=/bin/sh" "exec_prefix=/usr/local" "infodir=/usr/local/share/info" "libdir=/usr/local/lib" "prefix=/usr/local" "AR=ar" "AS=as" "CC=gcc-4.2" "CXX=c++" "LD=ld" "NM=/usr/bin/nm" "RANLIB=ranlib" "DESTDIR=" all-recursive
make[2]: *** No rule to make target `HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/missing --run makeinfo '.  Stop.
make[1]: *** [all] Error 2
make: *** ["/Volumes/Secondary] Error 2

非常感谢您的帮助。

看起来
ffi
gem也不喜欢路径中的空格,正如您已经在
config
中检查的那样,使用此路径不是ruby,必须是在编译gem的过程中

要使其编译,您需要去掉空格,有几种方法:

  • 在没有空格的路径中重新安装rvm,首先需要更改
    rvm_路径
    ~/.rvmrc
    中的位置,这是“安全”选择
  • 将rvm直接移动到
    rvm_path
    -
    sudo rm-rf/chetanshenoy.rvm&&sudo mv”/Volumes/Secondary-HDD/Users/chetanshenoy/.rvm/chetanshenoy.rvm
    -这应该可以工作,因为ruby没有主目录的记录,但不能确定带空格的路径是否保存在任何位置-如果出现问题,请使用解决方案1
  • 如中所述,ffi似乎被配置为查找“gcc-4.2”,因此,一旦我更新了我的(可能需要也可能不需要),我就创建了一个符号链接,以使ffi安装配置满意:

    sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
    

    你能包括
    /chetanshenoy.rvm/rubies/ruby-1.9.3-p194/config吗
    -最好使用这个文件,因为这个文件相当大。@mpapis这里是配置:这是我想的-这可能是安装
    ffi
    的方式中的错误,ruby没有带空格的路径记录,你试过最新版本或之前版本的ffi吗?是的,我认为这是一个bug。不幸的是,Octopress的一个依赖项需要特定版本的
    ffi
    。我会试着想出一个解决办法。谢谢,如果您有任何其他想法,请告诉我。如果您对
    $HOME
    中的空格使用“修复”,您可以尝试以其他方式进行修复:
    sudo rm-rf/chetanshenoy.rvm&&sudo mv”/Volumes/Secondary-HDD/Users/chetanshenoy/.rvm”/chetanshenoy.rvm
    感谢您的帮助。我最终只是编辑了gem并更新了libffi生成文件。我最终需要弄清楚如何在不破坏任何设置的情况下移动
    rvm