当我运行bundle install时,我收到以下错误。它说检查mkmf.log文件。我怎么找到mkmf.log文件?
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/.rubies/ruby-2.1.3/bin/ruby -r ./siteconf20150228-3404-1f8s19v.rb extconf.rb
*** 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}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/.rubies/ruby-2.1.3/bin/ruby
extconf.rb:45:in `open': No such file or directory @ dir_initialize - /usr/bin/include (Errno::ENOENT)
from extconf.rb:45:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /home/.gem/ruby/2.1.3/gems/rjb-1.4.9 for inspection.
Results logged to /home/.gem/ruby/2.1.3/extensions/x86_64-linux/2.1.0-static/rjb-1.4.9/gem_make.out
An error occurred while installing rjb (1.4.9), and Bundler cannot continue.
Make sure that `gem install rjb -v '1.4.9'` succeeds before bundling.
我在尝试安装时遇到错误
gem install rjb -v '1.4.9'
所以我找到了mkmf.log文件。它有以下错误。它正在寻找缺少的jni.h库。我该怎么做才能解决这个问题?
have_header: checking for jni.h... -------------------- no
"gcc -o conftest -I/home/.rubies/ruby-2.1.3/include/ruby-2.1.0/x86_64-linux -I/home/.rubies/ruby-2.1.3/include/ruby-2.1.0/ruby/backward -I/home/.rubies/ruby-2.1.3/include/ruby-2.1.0 -I. -I"/usr/bin/include" -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -I"/usr/bin/include" conftest.c -L. -L/home/.rubies/ruby-2.1.3/lib -Wl,-R/home/.rubies/ruby-2.1.3/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/.rubies/ruby-2.1.3/lib -L/home/.rubies/ruby-2.1.3/lib -lruby-static -lpthread -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -E -I/home/.rubies/ruby-2.1.3/include/ruby-2.1.0/x86_64-linux -I/home/.rubies/ruby-2.1.3/include/ruby-2.1.0/ruby/backward -I/home/.rubies/ruby-2.1.3/include/ruby-2.1.0 -I. -I"/usr/bin/include" -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -I"/usr/bin/include" conftest.c -o conftest.i"
conftest.c:3:17: fatal error: jni.h: No such file or directory
#include <jni.h>
^
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <jni.h>
/* end */
--------------------
~
~
~
"mkmf.log" 27L, 1710C
答案 0 :(得分:3)
要检查的4个可能性:
如果它不在其中任何一个中,请尝试使用以下命令搜索整个系统:
find / -name mkmf.log 2>/dev/null
要解决其他问题,请执行以下操作:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
答案 1 :(得分:0)
有时它不适用于OpenJdk,有时需要专有的完整JDK版本。我用以下方法解决了这个问题: