无法构建本机扩展
Failed to build native extension
我大约两周前切换到 Linux Mint 并想为我的网站安装我的包,但我的终端给我错误
解决依赖关系......
使用耙子 11.2.2
使用 i18n 0.7.0
使用 json 1.8.3
使用 minitest 5.9.0
使用 thread_safe 0.3.5
使用构建器 3.2.2
使用 erubis 2.7.0
使用 mini_portile2 2.1.0
使用 pkg-config 1.1.7
使用机架 1.6.4
使用 mime-types-data 3.2016.0521
使用 arel 6.0.3
使用本机扩展安装 debug_inspector 0.0.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext /debug_inspector
/usr/bin/ruby2.3 -r ./siteconf20160830-6661-3kryhn.rb extconf.rb
creating Makefile
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext/debug_inspector
make "DESTDIR=" clean
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext/debug_inspector
make "DESTDIR="
compiling debug_inspector.c
In file included from /usr/include/ruby-2.3.0/ruby/ruby.h:36:0,
from debug_inspector.c:12:
/usr/include/ruby-2.3.0/ruby/defines.h:26:19: fatal error: stdio.h: No such file or directory
compilation terminated.
Makefile:239: recipe for target 'debug_inspector.o' failed
make: *** [debug_inspector.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.3.0 /gems/debug_inspector-0.0.2 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/debug_inspector-0.0.2/gem_make.out
Using bundler 1.11.2
Installing byebug 9.0.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/byebug-9.0.5/ext/byebug
/usr/bin/ruby2.3 -r ./siteconf20160830-6661-18ytmbw.rb extconf.rb
创建 Makefile
current directory: /var/lib/gems/2.3.0/gems/byebug-9.0.5/ext/byebug
make "DESTDIR=" clean
current directory: /var/lib/gems/2.3.0/gems/byebug-9.0.5/ext/byebug
make "DESTDIR="
compiling breakpoint.c
In file included from /usr/include/ruby-2.3.0/ruby/ruby.h:36:0,
from /usr/include/ruby-2.3.0/ruby.h:33,
from byebug.h:4,
from breakpoint.c:1:
/usr/include/ruby-2.3.0/ruby/defines.h:26:19: fatal error: stdio.h: No such file or directory
compilation terminated.
Makefile:239: recipe for target 'breakpoint.o' failed
make: *** [breakpoint.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.3.0/gems/byebug-9.0.5 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/byebug-9.0.5/gem_make.out
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using thor 0.19.1
Using concurrent-ruby 1.0.2
Using multi_json 1.12.1
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.2
Installing sqlite3 1.3.11 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/sqlite3-1.3.11/ext/sqlite3
/usr/bin/ruby2.3 -r ./siteconf20160830-6661-3zztze.rb extconf.rb
检查 sqlite3.h... * extconf.rb 失败 *
由于某种原因无法创建 Makefile,可能是缺少必要的
图书馆 and/or headers。查看 mkmf.log 文件以获取更多详细信息。你可以
需要配置选项。
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=/usr/bin/$(RUBY_BASE_NAME)2.3
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
from /usr/lib/ruby/2.3.0/mkmf.rb:1144:in `block in find_header'
from /usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from /usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from /usr/lib/ruby/2.3.0/mkmf.rb:1143:in `find_header'
from extconf.rb:30:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.11/mkmf.log
extconf 失败,退出代码 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/sqlite3-1.3.11 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.11/gem_make.out
Using turbolinks-source 5.0.0
Using rdoc 4.2.2
Using tzinfo 1.2.2
Installing nokogiri 1.6.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20160830-6661-657qsw.rb extconf.rb
使用 pkg-config 版本 1.1.7
检查 C 编译器是否接受 ... * extconf.rb 失败 *
由于某种原因无法创建 Makefile,可能是缺少必要的
图书馆 and/or headers。查看 mkmf.log 文件以获取更多详细信息。你可以
需要配置选项。
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=/usr/bin/$(RUBY_BASE_NAME)2.3
--help
--clean
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.3.0/mkmf.rb:571:in `block in try_compile'
from /usr/lib/ruby/2.3.0/mkmf.rb:522:in `with_werror'
from /usr/lib/ruby/2.3.0/mkmf.rb:571:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/lib/ruby/2.3.0/mkmf.rb:629:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:414:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out
Using rack-test 0.6.3
Using mime-types 3.1
An error occurred while installing debug_inspector (0.0.2), and Bundler cannot
continue.
Make sure that `gem install debug_inspector -v '0.0.2'` succeeds before
bundling.
我试过这样安装 debug_inspector
gem 安装 debug_inspector -v 0.0.2
结果:
构建本机扩展。这可能需要一段时间...
错误:安装 debug_inspector 时出错:
错误:无法构建 gem 本机扩展。
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext/ \debug_inspector
/usr/bin/ruby2.3 -r ./siteconf20160830-6775-1iui5kl.rb extconf.rb
creating Makefile
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext /debug_inspector
make "DESTDIR=" clean
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext/debug_inspector
make "DESTDIR="
compiling debug_inspector.c
In file included from /usr/include/ruby-2.3.0/ruby/ruby.h:36:0,
from debug_inspector.c:12:
/usr/include/ruby-2.3.0/ruby/defines.h:26:19: fatal error: stdio.h: No such file or directory
compilation terminated.
Makefile:239: recipe for target 'debug_inspector.o' failed
make: *** [debug_inspector.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/debug_inspector-0.0.2/gem_make.out
编辑
json 运行同样的错误
将尝试重新安装整个 ruby 系统
编辑2
安装 devkit 并重试
以下代码解决了我的问题
sudo apt-get install build-essential patch
sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
对于 Linux Mint 18 上的 Rails,添加库:
build-essential patch ruby-dev zlib1g-dev liblzma-dev libsqlite3-dev
这对我有用:
sudo apt-get install libmagickcore-dev libmagickwand-dev
我在对此 link 进行了大量研究后发现的。
我大约两周前切换到 Linux Mint 并想为我的网站安装我的包,但我的终端给我错误 解决依赖关系...... 使用耙子 11.2.2 使用 i18n 0.7.0 使用 json 1.8.3 使用 minitest 5.9.0 使用 thread_safe 0.3.5 使用构建器 3.2.2 使用 erubis 2.7.0 使用 mini_portile2 2.1.0 使用 pkg-config 1.1.7 使用机架 1.6.4 使用 mime-types-data 3.2016.0521 使用 arel 6.0.3 使用本机扩展安装 debug_inspector 0.0.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext /debug_inspector
/usr/bin/ruby2.3 -r ./siteconf20160830-6661-3kryhn.rb extconf.rb
creating Makefile
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext/debug_inspector
make "DESTDIR=" clean
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext/debug_inspector
make "DESTDIR="
compiling debug_inspector.c
In file included from /usr/include/ruby-2.3.0/ruby/ruby.h:36:0,
from debug_inspector.c:12:
/usr/include/ruby-2.3.0/ruby/defines.h:26:19: fatal error: stdio.h: No such file or directory
compilation terminated.
Makefile:239: recipe for target 'debug_inspector.o' failed
make: *** [debug_inspector.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.3.0 /gems/debug_inspector-0.0.2 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/debug_inspector-0.0.2/gem_make.out
Using bundler 1.11.2
Installing byebug 9.0.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/byebug-9.0.5/ext/byebug
/usr/bin/ruby2.3 -r ./siteconf20160830-6661-18ytmbw.rb extconf.rb 创建 Makefile
current directory: /var/lib/gems/2.3.0/gems/byebug-9.0.5/ext/byebug
make "DESTDIR=" clean
current directory: /var/lib/gems/2.3.0/gems/byebug-9.0.5/ext/byebug
make "DESTDIR="
compiling breakpoint.c
In file included from /usr/include/ruby-2.3.0/ruby/ruby.h:36:0,
from /usr/include/ruby-2.3.0/ruby.h:33,
from byebug.h:4,
from breakpoint.c:1:
/usr/include/ruby-2.3.0/ruby/defines.h:26:19: fatal error: stdio.h: No such file or directory
compilation terminated.
Makefile:239: recipe for target 'breakpoint.o' failed
make: *** [breakpoint.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.3.0/gems/byebug-9.0.5 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/byebug-9.0.5/gem_make.out
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using thor 0.19.1
Using concurrent-ruby 1.0.2
Using multi_json 1.12.1
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.2
Installing sqlite3 1.3.11 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/sqlite3-1.3.11/ext/sqlite3
/usr/bin/ruby2.3 -r ./siteconf20160830-6661-3zztze.rb extconf.rb 检查 sqlite3.h... * extconf.rb 失败 * 由于某种原因无法创建 Makefile,可能是缺少必要的 图书馆 and/or headers。查看 mkmf.log 文件以获取更多详细信息。你可以 需要配置选项。
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=/usr/bin/$(RUBY_BASE_NAME)2.3
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
from /usr/lib/ruby/2.3.0/mkmf.rb:1144:in `block in find_header'
from /usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from /usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from /usr/lib/ruby/2.3.0/mkmf.rb:1143:in `find_header'
from extconf.rb:30:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.11/mkmf.log extconf 失败,退出代码 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/sqlite3-1.3.11 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.11/gem_make.out
Using turbolinks-source 5.0.0
Using rdoc 4.2.2
Using tzinfo 1.2.2
Installing nokogiri 1.6.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20160830-6661-657qsw.rb extconf.rb 使用 pkg-config 版本 1.1.7 检查 C 编译器是否接受 ... * extconf.rb 失败 * 由于某种原因无法创建 Makefile,可能是缺少必要的 图书馆 and/or headers。查看 mkmf.log 文件以获取更多详细信息。你可以 需要配置选项。
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=/usr/bin/$(RUBY_BASE_NAME)2.3
--help
--clean
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.3.0/mkmf.rb:571:in `block in try_compile'
from /usr/lib/ruby/2.3.0/mkmf.rb:522:in `with_werror'
from /usr/lib/ruby/2.3.0/mkmf.rb:571:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/lib/ruby/2.3.0/mkmf.rb:629:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:414:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out
Using rack-test 0.6.3
Using mime-types 3.1
An error occurred while installing debug_inspector (0.0.2), and Bundler cannot
continue.
Make sure that `gem install debug_inspector -v '0.0.2'` succeeds before
bundling.
我试过这样安装 debug_inspector gem 安装 debug_inspector -v 0.0.2 结果: 构建本机扩展。这可能需要一段时间... 错误:安装 debug_inspector 时出错: 错误:无法构建 gem 本机扩展。
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext/ \debug_inspector
/usr/bin/ruby2.3 -r ./siteconf20160830-6775-1iui5kl.rb extconf.rb
creating Makefile
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext /debug_inspector
make "DESTDIR=" clean
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext/debug_inspector
make "DESTDIR="
compiling debug_inspector.c
In file included from /usr/include/ruby-2.3.0/ruby/ruby.h:36:0,
from debug_inspector.c:12:
/usr/include/ruby-2.3.0/ruby/defines.h:26:19: fatal error: stdio.h: No such file or directory
compilation terminated.
Makefile:239: recipe for target 'debug_inspector.o' failed
make: *** [debug_inspector.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/debug_inspector-0.0.2/gem_make.out
编辑 json 运行同样的错误 将尝试重新安装整个 ruby 系统 编辑2 安装 devkit 并重试
以下代码解决了我的问题
sudo apt-get install build-essential patch
sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
对于 Linux Mint 18 上的 Rails,添加库:
build-essential patch ruby-dev zlib1g-dev liblzma-dev libsqlite3-dev
这对我有用:
sudo apt-get install libmagickcore-dev libmagickwand-dev
我在对此 link 进行了大量研究后发现的。