【问题标题】:gem install ffi -v '1.1.5' osx 10.8宝石安装 ffi -v '1.1.5' osx 10.8
【发布时间】:2012-08-12 03:19:12
【问题描述】:

我一直在尝试通过

在 OSX 10.8 上安装 ffi
gem install ffi -v '1.1.5'

结果

ERROR:  Error installing ffi:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for rb_thread_blocking_region()... no
checking for ruby_native_thread_p()... no
checking for rb_thread_call_with_gvl()... no
creating extconf.h
creating Makefile

make
mkdir -p "/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c"/libffi-i386; (if [ ! -f       "/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c"/libffi-i386/Makefile ]; then echo "Configuring libffi for i386"; cd "/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c"/libffi-i386 && env CC=" xcrun cc" CFLAGS="-arch i386 " LDFLAGS="-arch i386" "/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c/libffi"/configure --disable-static --with-pic=yes --disable-dependency-tracking --host=i386-apple-darwin > /dev/null; fi); env MACOSX_DEPLOYMENT_TARGET=10.4 make -C "/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c"/libffi-i386
Configuring libffi for i386
configure: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used
configure: error: in `/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c/libffi-i386':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[1]: *** No targets specified and no makefile found.  Stop.
make: *** ["/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c"/libffi-   i386/.libs/libffi_convenience.a] Error 2


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/ffi-1.1.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c/gem_make.out

我已尝试关注

An error occured while installing ffi (1.1.2), and Bundler cannot continue

Not able to install some gems after mountain lion upgrade

运气不好。

【问题讨论】:

    标签: macos gem


    【解决方案1】:

    我的 ffi 安装失败并出现非常相似的错误消息:

    mkdir -p "/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c"/libffi-i386; (if [ ! -f "/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c"/libffi-i386/Makefile ]; then echo "Configuring libffi for i386"; cd "/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c"/libffi-i386 && env CC=" xcrun cc" CFLAGS="-arch i386 " LDFLAGS="-arch i386" "/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c/libffi"/configure --disable-static --with-pic=yes --disable-dependency-tracking --host=i386-apple-darwin > /dev/null; fi); env MACOSX_DEPLOYMENT_TARGET=10.4 make -C "/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c"/libffi-i386
    Configuring libffi for i386
    configure: WARNING: if you wanted to set the --build type, don't use --host.
        If a cross compiler is detected then cross compile mode will be used
    configure: error: in `/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c/libffi-i386':
    configure: error: C compiler cannot create executables
    

    我在命令中发现 xcrun cc 并尝试手动运行它给了我 Apple 的消息,即我没有同意 XCode 命令行工具的许可协议。 sudo xcrun cc 后安装成功。

    $ xcrun cc
    Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
    $ sudo xcrun cc
    You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.
    Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
    ...
    

    ```

    【讨论】:

    • 这种情况不仅发生在第一次安装 XCode 之后,而且在 Apple 更改许可证的任何时候都会发生。因此,在您接受新的许可协议之前,XCode 更新可能会导致 XCode 工具停止工作。
    【解决方案2】:

    看起来 ffi 坚持构建 32 位版本,而您的系统运行 64 位。

    很可能有两种方法可以继续:

    1. 尝试使用最新版本的 gem gem install ffi - 但这不一定有效 - 因为这需要在库中修复,
    2. 编译 32 位 ruby​​ rvm install 1.9.3-n32 --32 - 但这也不必工作,因为大多数库很可能会编译为 64 位,因此它可能无法编译或编译并出现问题

    【讨论】:

      【解决方案3】:

      尝试安装Xcode Command Line Toolshttps://github.com/kennethreitz/osx-gcc-installer

      【讨论】:

        猜你喜欢
        • 2016-01-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-03-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多