简体   繁体   English

错误:安装 ffi 时出错:错误:无法构建 gem 本机扩展

[英]ERROR: Error installing ffi: ERROR: Failed to build gem native extension

Got the DevKit installed and re-ran the ffi install….got this as an output:安装了 DevKit 并重新运行 ffi 安装……得到了 output:

C:\Documents and Settings\******>gem install ffi
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing ffi:
        ERROR: Failed to build gem native extension.

        C:/Ruby192/bin/ruby.exe 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_thread_has_gvl_p()... yes
checking for ruby_native_thread_p()... yes
checking for rb_thread_call_with_gvl()... yes
creating extconf.h
creating Makefile
make
C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_ffi_c'"  > ffi_c-i386-mingw32.def
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DRUBY_EXTCONF_H=\"extcon
f.h\"    -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -
Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-declaration-a
fter-statement   -o AbstractMemory.o -c AbstractMemory.c
In file included from AbstractMemory.c:28:0:
compat.h:65:20: warning: extra tokens at end of #ifndef directive
compat.h:69:24: warning: extra tokens at end of #ifndef directive
In file included from AbstractMemory.h:29:0,
                 from AbstractMemory.c:29:
Types.h:68:17: fatal error: ffi.h: No such file or directory
compilation terminated.
make: *** [AbstractMemory.o] Error 1 

Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.1
0 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.10/ext/ffi_c/gem_m
ake.out
_________________________________________________________________________________

Not sure how to deal with this issue.不知道如何处理这个问题。 Kindly help.请帮忙。

The gem install ffi fails due to the gem trying to build a bundled copy of libffi, which does not work due to assumptions that /usr/bin/env exists and too old libffi copy.由于 gem 尝试构建 libffi 的捆绑副本,gem install ffi 失败,由于假设 /usr/bin/env 存在且 libffi 副本太旧,该副本不起作用。

However, you can build the ffi gem against the system libffi - install the packages:但是,您可以针对系统 libffi 构建 ffi gem - 安装软件包:

apt install clang make ruby-dev libffi-dev

After that the ffi gem should build:之后,ffi gem 应该构建:

gem install ffi

Version 1.0.10 has issues compiling on windows. 1.0.10 版在 Windows 上编译存在问题。

You can use the 1.0.9您可以使用 1.0.9

gem install ffi --version='1.0.9'
sudo apt-get install libffi-dev

这对我有用

For me the fix was running in this order.对我来说,修复程序按此顺序运行。 I'm not sure what all was relevant, but it worked:我不确定所有相关的内容,但它有效:

gem install ffi --version '1.0.9'

The above failed, but then I could successfully run:以上失败,但后来我可以成功运行:

gem install bundler

...and subsequently: ...随后:

gem install ffi

...which got the latest version (1.6.0 at the time of writing this) and installed it successfully. ...获得了最新版本(撰写本文时为 1.6.0)并成功安装。

Note that installing version 1.0.9 isn't going to be enough if your bundler keeps trying to go out and grab the latest version.请注意,如果您的打包程序不断尝试获取最新版本,则安装 1.0.9 版本是不够的。 In your gemfile you'll also want to put:在您的 gemfile 中,您还需要放置:

gem 'ffi', '1.0.9'

This should satisfy the dependency for whatever gem is asking for it and let you get up and running.这应该满足对任何 gem 要求的依赖,并让您启动并运行。

when the above steps are followed, it might results the following message.执行上述步骤后,可能会出现以下消息。

$ bundle install
Fetching source index for https://rubygems.org/
You have requested:
ffi = 1.0.9

The bundle currently has ffi locked at 1.0.11.
Try running `bundle update ffi`

In that case, you can run the 'bundle update ffi' command and the error will be solved.在这种情况下,您可以运行“bundle update ffi”命令,错误将得到解决。

Installing the 'osx-gcc-installer' worked for me: (osx 10.8)安装“osx-gcc-installer”对我有用:(osx 10.8)

https://github.com/kennethreitz/osx-gcc-installer/downloads https://github.com/kennethreitz/osx-gcc-installer/downloads

Helped me:帮助过我:

sudo apt install build-essential

Debian 9 Debian 9

Ruby 2.3.3红宝石 2.3.3

你需要这个,

apt-get install ruby2.2-dev

Copied from another post :复制自另一个帖子

As stated in Issue with installing ImageMagick and rmagick on Mountain Lion , ffi appears to be configured to look for 'gcc-4.2', so once I updated my Apple command line tools (which I may or may not have needed to do), I created a symbolic link to make the ffi install configuration happy:正如在 Mountain Lion 上安装 ImageMagick 和 rmagick 的问题中所述,ffi 似乎被配置为寻找“gcc-4.2”,所以一旦我更新了我的Apple 命令行工具(我可能需要也可能不需要这样做),我创建了一个符号链接以使 ffi 安装配置满意:

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

对我来说,这通常有效

gem install ffi -- --disable-system-libffi

将 DevKit 放在 PATH 前面,然后从 Windows 命令提示符再次安装。

I got the same problem.我遇到了同样的问题。 In my case, I have not install the DevKit, which can be found: http://rubyinstaller.org/downloads/ .就我而言,我还没有安装 DevKit,可以找到: http ://rubyinstaller.org/downloads/。 After installing DevKit, just follow the instruction https://github.com/oneclick/rubyinstaller/wiki/development-kit and finally it's up and running.安装 DevKit 后,只需按照https://github.com/oneclick/rubyinstaller/wiki/development-kit的说明进行操作,最后它就可以启动并运行了。

I had to install automake to get it working.我必须安装automake才能让它工作。 Worked on both mac OSX as well as Ubuntu (CI machine).在 mac OSX 和 Ubuntu(CI 机器)上工作。

在 MacOS(Catalina)上,运行brew install libtool首先为我解决了这个问题。

这对我gem install ffi -- --disable-system-libffi on Ubuntu 20.04 (WSL)

Run this: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh )"运行这个:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh )"

Then: brew install cocoapods然后:brew install cocoapods

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RN CLI 错误 - 构建 gem 本机扩展失败,安装 ffi 时出错 - RN CLI error - Failed to build gem native extension, error occurred while installing ffi 错误:安装jekyll时出错:错误:无法构建gem原生扩展 - ERROR: Error installing jekyll: ERROR: Failed to build gem native extension 错误:安装nokogiri时出错:错误:无法构建gem本机扩展 - ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension 错误:安装错误 sass:错误:无法构建 gem 本机扩展 - ERROR: Error installing sass: ERROR: Failed to build gem native extension 错误:安装pg时出错:错误:无法构建gem原生扩展 - ERROR: Error installing pg: ERROR: Failed to build gem native extension 错误:安装导轨时出错:错误:无法构建 gem 本机扩展 - ERROR: Error installing rails: ERROR: Failed to build gem native extension 错误:安装 gollum 时出错:错误:无法构建 gem 本机扩展 - ERROR: Error installing gollum: ERROR: Failed to build gem native extension 错误:安装 json 时出错:错误:无法构建 gem 原生扩展 - ERROR: Error installing json: ERROR: Failed to build gem native extension 安装mysql2 gem时出错:无法构建gem原生扩展 - Error installing mysql2 gem: Failed to build gem native extension 错误:安装Sablon gem时无法构建gem本机扩展 - ERROR: Failed to build gem native extension when installing Sablon gem
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM