安装ffi ruby gem时无法找到ffi.h
Ruby版本2.2.4p230
RubyGem版本2.7.2
安装了Ruby-devel和lib64ffi-devel。
使用64位OpenMandriva 3.0,urpmi和rpmdrake。
目标:安装指南针,但首先需要gemffi。
在过去的两天里,我一直在努力搜索互联网,我很难过……我不可能安装早期版本的ruby,因为它依赖于较旧的ncurses。 我觉得替换ncurses会打开一jar令人讨厌的蠕虫。
但是……我也完全接受罗盘替代方案,其中config.rb项目文件可以以某种方式移植/复制,因此罗盘和其他sass编译器都可以运行。 (这是为了工作,我们不会很快改变sass建设者)。
/usr/share/gems/gems/ffi-1.9.18/ext/ffi_c完全存在,该目录中有一个ffi.c文件,但在附近找不到任何ffi.h文件。 在绝望的时刻,我触摸了该目录中的ffi.h,当我运行gem install时将其删除。 ;)我会尝试取一个别人的libs副本,看看是否有效。
基本上任何方法都可以在不破坏我的其他包的情况下实现这一点。 我不会用ruby做任何其他事情,只需指南针。
这是输出:
# sudo gem install ffi Building native extensions. This could take a while... ERROR: Error installing ffi: ERROR: Failed to build gem native extension. current directory: /usr/share/gems/gems/ffi-1.9.18/ext/ffi_c /usr/bin/ruby -r ./siteconf20171110-17988-1lodsok.rb extconf.rb checking for ffi.h... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib64 --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/$(RUBY_BASE_NAME) --with-ffi_c-dir --without-ffi_c-dir --with-ffi_c-include --without-ffi_c-include=${ffi_c-dir}/include --with-ffi_c-lib --without-ffi_c-lib=${ffi_c-dir}/lib64 --with-libffi-config --without-libffi-config --with-pkg-config --without-pkg-config /usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/share/ruby/mkmf.rb:587:in `try_cpp' from /usr/share/ruby/mkmf.rb:1060:in `block in have_header' from /usr/share/ruby/mkmf.rb:911:in `block in checking_for' from /usr/share/ruby/mkmf.rb:351:in `block (2 levels) in postpone' from /usr/share/ruby/mkmf.rb:321:in `open' from /usr/share/ruby/mkmf.rb:351:in `block in postpone' from /usr/share/ruby/mkmf.rb:321:in `open' from /usr/share/ruby/mkmf.rb:347:in `postpone' from /usr/share/ruby/mkmf.rb:910:in `checking_for' from /usr/share/ruby/mkmf.rb:1059:in `have_header' from extconf.rb:16:in `' To see why this extension failed to compile, please check the mkmf.log which can be found here: /usr/lib64/gems/ruby/ffi-1.9.18/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /usr/share/gems/gems/ffi-1.9.18 for inspection. Results logged to /usr/lib64/gems/ruby/ffi-1.9.18/gem_make.out
任何帮助赞赏!
您的错误消息显示:
/usr/share/ruby/mkmf.rb:456:in`try_do’:编译器无法生成可执行文件。 (RuntimeError)您必须首先安装开发工具。
这就是你如何解决它:
xcode-select --install
(但请事先确保xcode-select -p
返回稳定Xcode版本的路径,如Xcode 10)
另见https://github.com/ffi/ffi/issues/647 。