gem install sqlite3 -v' 1.3.11'`捆绑前成功错误:错误:无法构建gem原生扩展

时间:2016-05-03 18:10:52

标签: ruby-on-rails ruby sqlite dependencies rvm

我试图运行"捆绑安装"到我的新rails应用程序! 我的 ruby​​ 版本:

ruby 2.3.0p0

我的 rails 版本:

Rails 4.1.0

我的 rvm 版本:

rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

但我得到了这个错误!

    Fetching gem metadata from http://rubygems.org/...........
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Resolving dependencies...........
Rubygems 2.0.3 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Using rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using rack 1.5.5
Using mime-types 1.25.1
Using polyglot 0.3.5
Using arel 5.0.1.20140414130214
Using bundler 1.11.2
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using thor 0.19.1
Using hike 1.2.3
Using multi_json 1.11.3
Using tilt 1.4.1
Using sass 3.2.19
Using spring 1.7.1
Installing sqlite3 1.3.11 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/afsane/.rvm/rubies/ruby-2.3.0/bin/ruby extconf.rb
checking for sqlite3.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}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/afsane/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/lib
/home/afsane/.rvm/rubies/ruby-2.3.0/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 /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:1144:in `block in find_header'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:1143:in `find_header'
    from extconf.rb:30:in `<main>'


Gem files will remain installed in /home/afsane/.rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.11 for inspection.
Results logged to /home/afsane/.rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.11/ext/sqlite3/gem_make.out
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using rack-test 0.6.3
Using treetop 1.4.15
Using coffee-script 2.4.1
Using uglifier 3.0.0
Using sprockets 2.12.4
An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
afsane@afsaneF:~/Desktop/Afsaneh/test2$ clear

afsane@afsaneF:~/Desktop/Afsaneh/test2$ cd
afsane@afsaneF:~$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
afsane@afsaneF:~$ ^C
afsane@afsaneF:~$ rails -v
Rails 4.1.0
afsane@afsaneF:~$ rvm -v
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
afsane@afsaneF:~$ cd Desktop
afsane@afsaneF:~/Desktop$ cd Afsaneh
afsane@afsaneF:~/Desktop/Afsaneh$ cd test1
afsane@afsaneF:~/Desktop/Afsaneh/test1$ bundle install
Fetching gem metadata from http://rubygems.org/...........
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Resolving dependencies...........
Rubygems 2.0.3 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Using rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using rack 1.5.5
Using mime-types 1.25.1
Using polyglot 0.3.5
Using arel 5.0.1.20140414130214
Using bundler 1.11.2
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using thor 0.19.1
Using columnize 0.9.0
Using debugger-linecache 1.2.0
Using debugger-ruby_core_source 1.3.8
Using hike 1.2.3
Using multi_json 1.11.3
Using tilt 1.4.1
Using sass 3.2.19
Using spring 1.7.1
Installing sqlite3 1.3.11 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/afsane/.rvm/rubies/ruby-2.3.0/bin/ruby extconf.rb
checking for sqlite3.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}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/afsane/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/lib
/home/afsane/.rvm/rubies/ruby-2.3.0/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 /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:1144:in `block in find_header'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:1143:in `find_header'
    from extconf.rb:30:in `<main>'


Gem files will remain installed in /home/afsane/.rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.11 for inspection.
Results logged to /home/afsane/.rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.11/ext/sqlite3/gem_make.out
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using rack-test 0.6.3
Using treetop 1.4.15
Using coffee-script 2.4.1
Using uglifier 3.0.0
Installing debugger 1.6.8 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/afsane/.rvm/rubies/ruby-2.3.0/bin/ruby 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/afsane/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
/home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:1392:in `initialize': No such file or directory @ rb_sysopen - ./230/ruby_debug.h (Errno::ENOENT)
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:1392:in `open'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:1392:in `copy_file'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:486:in `copy_file'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:403:in `block in cp'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:1571:in `block in fu_each_src_dest'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:1585:in `fu_each_src_dest0'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:1569:in `fu_each_src_dest'
    from /home/afsane/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:402:in `cp'
    from extconf.rb:83:in `block in <main>'
    from extconf.rb:82:in `each'
    from extconf.rb:82:in `<main>'


Gem files will remain installed in /home/afsane/.rvm/gems/ruby-2.3.0/gems/debugger-1.6.8 for inspection.
Results logged to /home/afsane/.rvm/gems/ruby-2.3.0/gems/debugger-1.6.8/ext/ruby_debug/gem_make.out
Using sprockets 2.12.4
An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.

提到由于 https 在我的国家/地区被屏蔽,我必须将其更改为 http 。我总是在我的电脑上执行此操作。 我的操作系统也是: Ubuntu 14.04.4 LTS

我尝试了一些解决方案,例如:

sudo apt-get install sqliteman sqlite3
sudo gem install sqlite3 -v '1.3.7'
sudo apt-get install -y sqlite3 libsqlite3-dev
gem install sqlite3
sudo gem update --system

依旧...... 但他们都没有为我工作! 你能否告诉我如何下载 Sqlite3 Dependencies 或者我可以如何安装 gem native extension ??? 在此先感谢您的考虑:)

1 个答案:

答案 0 :(得分:1)

这可能是sqlite3 gem fails to install的副本。

当你做

时它是否有效
gem install sqlite3 -- --with-sqlite3-dir=/opt/local

或者如果需要,可以预先添加Sudo。