安装debug_inspector(0.0.2)时发生错误,Bundler无法继续

将我的rails应用程序从3.2迁移到4.0.0,将ruby 2.2.2迁移到2.2.4

在进行bundle install时(安装debug_inspector(0.0.2)时出错,而Bundler无法继续)问题。

使用ubuntu 14.04LTS。

当我输入bundle命令时会发生这种情况

Installing debug_inspector 0.0.2 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/share/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160727-7643-zx17cc.rb extconf.rb creating Makefile make "DESTDIR=" clean make "DESTDIR=" compiling debug_inspector.c linking shared-object debug_inspector.so /usr/bin/ld: cannot find -lgmp collect2: error: ld returned 1 exit status make: *** [debug_inspector.so] Error 1 make failed, exit code 2 Gem files will remain installed in /home/vpidev/.rvm/gems/ruby-2.2.4@ping/gems/debug_inspector-0.0.2 for inspection. Results logged to /home/vpidev/.rvm/gems/ruby-2.2.4@ping/extensions/x86_64-linux/2.2.0/debug_inspector-0.0.2/gem_make.out Using sass 3.4.22 Using will_paginate 3.0.7 Using uniform_notifier 1.10.0 Installing byebug 9.0.5 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/share/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160727-7643-1w1gc0x.rb extconf.rb creating Makefile make "DESTDIR=" clean make "DESTDIR=" compiling context.c compiling locker.c compiling threads.c compiling breakpoint.c compiling byebug.c linking shared-object byebug/byebug.so /usr/bin/ld: cannot find -lgmp collect2: error: ld returned 1 exit status make: *** [byebug.so] Error 1 make failed, exit code 2 Gem files will remain installed in /home/vpidev/.rvm/gems/ruby-2.2.4@ping/gems/byebug-9.0.5 for inspection. Results logged to /home/vpidev/.rvm/gems/ruby-2.2.4@ping/extensions/x86_64-linux/2.2.0/byebug-9.0.5/gem_make.out Using highline 1.7.8 Using net-ssh 3.2.0 Using mini_portile 0.6.2 Installing json 1.8.3 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/share/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160727-7643-6baclf.rb extconf.rb creating Makefile make "DESTDIR=" clean make "DESTDIR=" compiling generator.c linking shared-object json/ext/generator.so /usr/bin/ld: cannot find -lgmp collect2: error: ld returned 1 exit status make: *** [generator.so] Error 1 make failed, exit code 2 Gem files will remain installed in /home/vpidev/.rvm/gems/ruby-2.2.4@ping/gems/json-1.8.3 for inspection. Results logged to /home/vpidev/.rvm/gems/ruby-2.2.4@ping/extensions/x86_64-linux/2.2.0/json-1.8.3/gem_make.out Installing ffi 1.9.14 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/share/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160727-7643-e5hbz0.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=/usr/share/rvm/rubies/ruby-2.2.4/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}/lib --with-libffi-config --without-libffi-config --with-pkg-config --without-pkg-config /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.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/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:556:in `try_link' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:637:in `try_ldflags' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:1780:in `pkg_config' from extconf.rb:15:in `' extconf failed, exit code 1 Gem files will remain installed in /home/vpidev/.rvm/gems/ruby-2.2.4@ping/gems/ffi-1.9.14 for inspection. Results logged to /home/vpidev/.rvm/gems/ruby-2.2.4@ping/extensions/x86_64-linux/2.2.0/ffi-1.9.14/gem_make.out Using cliver 0.3.2 Using sexp_processor 4.7.0 Using coffee-script-source 1.10.0 Using execjs 2.7.0 Using country_select 1.2.0 Using daemons 1.0.10 Using database_cleaner 1.5.3 Using debugger-ruby_core_source 1.3.8 Using docile 1.1.5 Using dynamic_form 1.1.4 Using encryptor 1.3.0 Installing eventmachine 1.2.0.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/share/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160727-7643-14d9qjy.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=/usr/share/rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME) --with-ssl-dir --without-ssl-dir --with-ssl-include --without-ssl-include=${ssl-dir}/include --with-ssl-lib --without-ssl-lib=${ssl-dir}/lib --with-openssl-config --without-openssl-config --with-pkg-config --without-pkg-config /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.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/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:556:in `try_link' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:637:in `try_ldflags' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:1780:in `pkg_config' from extconf.rb:65:in `pkg_config_wrapper' from extconf.rb:92:in `' extconf failed, exit code 1 Gem files will remain installed in /home/vpidev/.rvm/gems/ruby-2.2.4@ping/gems/eventmachine-1.2.0.1 for inspection. Results logged to /home/vpidev/.rvm/gems/ruby-2.2.4@ping/extensions/x86_64-linux/2.2.0/eventmachine-1.2.0.1/gem_make.out Using gem_plugin 0.2.3 Using tilt 2.0.5 Using hashie 3.4.4 Using headless 2.2.3 Using multi_xml 0.5.5 Installing libxml-ruby 2.7.0 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/share/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160727-7643-ftfa2z.rb extconf.rb checking for socket() in -lsocket... *** 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=/usr/share/rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME) --with-iconv-dir --without-iconv-dir --with-iconv-include --without-iconv-include=${iconv-dir}/include --with-iconv-lib --without-iconv-lib=${iconv-dir}/lib --with-zlib-dir --without-zlib-dir --with-zlib-include --without-zlib-include=${zlib-dir}/include --with-zlib-lib --without-zlib-lib=${zlib-dir}/lib --with-socketlib --without-socketlib /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.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/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:556:in `try_link' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:735:in `try_func' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:966:in `block in have_library' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:321:in `open' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:321:in `open' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:347:in `postpone' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:961:in `have_library' from extconf.rb:29:in `' extconf failed, exit code 1 Gem files will remain installed in /home/vpidev/.rvm/gems/ruby-2.2.4@ping/gems/libxml-ruby-2.7.0 for inspection. Results logged to /home/vpidev/.rvm/gems/ruby-2.2.4@ping/extensions/x86_64-linux/2.2.0/libxml-ruby-2.7.0/gem_make.out Using light-daemon 0.9.7 Using systemu 2.4.2 Using memcache-client 1.8.5 Using metaclass 0.0.4 Using method_source 0.8.2 Using mustache 1.0.3 Installing mysql2 0.3.21 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/share/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160727-7643-1dru9tp.rb extconf.rb checking for ruby/thread.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=/usr/share/rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME) /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.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/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:321:in `open' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:321:in `open' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:347:in `postpone' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for' from /usr/share/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header' from extconf.rb:15:in `' extconf failed, exit code 1 Gem files will remain installed in /home/vpidev/.rvm/gems/ruby-2.2.4@ping/gems/mysql2-0.3.21 for inspection. Results logged to /home/vpidev/.rvm/gems/ruby-2.2.4@ping/extensions/x86_64-linux/2.2.0/mysql2-0.3.21/gem_make.out Using newrelic_rpm 3.9.9.275 Using nori 1.0.2 Installing oj 2.17.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/share/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160727-7643-xze21i.rb extconf.rb >>>>> Creating Makefile for ruby version 2.2.4 on x86_64-linux <<<<< creating Makefile make "DESTDIR=" clean make "DESTDIR=" compiling err.c compiling strict.c compiling parse.c compiling cache8.c compiling scp.c compiling fast.c compiling odd.c compiling reader.c compiling compat.c compiling sparse.c compiling object.c compiling hash.c compiling resolve.c compiling saj.c compiling oj.c compiling hash_test.c compiling dump.c compiling circarray.c compiling val_stack.c linking shared-object oj/oj.so /usr/bin/ld: cannot find -lgmp collect2: error: ld returned 1 exit status make: *** [oj.so] Error 1 make failed, exit code 2 Gem files will remain installed in /home/vpidev/.rvm/gems/ruby-2.2.4@ping/gems/oj-2.17.1 for inspection. Results logged to /home/vpidev/.rvm/gems/ruby-2.2.4@ping/extensions/x86_64-linux/2.2.0/oj-2.17.1/gem_make.out Using parallel 1.9.0 Using websocket-extensions 0.1.2 Using power_assert 0.3.0 Using slop 3.6.0 Using rails-simple-search 0.9.9 Using require_all 1.3.3 Using ruby-progressbar 1.8.1 Using rbx-require-relative 0.0.9 Installing rjb 1.5.3 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/share/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160727-7643-r362l.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=/usr/share/rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME) extconf.rb:53:in `': JAVA_HOME is not set. (RuntimeError) extconf failed, exit code 1 Gem files will remain installed in /home/vpidev/.rvm/gems/ruby-2.2.4@ping/gems/rjb-1.5.3 for inspection. Results logged to /home/vpidev/.rvm/gems/ruby-2.2.4@ping/extensions/x86_64-linux/2.2.0/rjb-1.5.3/gem_make.out Using rubyzip 1.2.0 Using rubygems-update 1.4.2 Using websocket 1.2.3 Using simplecov-html 0.10.0 Using temple 0.7.7 Using tabs_on_rails 1.3.3 Using minitest-test 1.1.0 Using activesupport 4.0.13 Using gyoku 1.0.0 Using rack-test 0.6.3 Using httpi 0.9.5 Using rack-utf8_sanitizer 1.3.2 Using mime-types 3.1 Using sprockets 3.6.3 Using concurrent-ruby-ext 1.0.2 Using fastimage 1.7.0 Using turn 0.9.7 Using better_errors 2.1.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. 

/usr/bin/ld: cannot find -lgmp意味着找不到gmp库。 试试跑步:

sudo apt-get install libgmp3-dev

bundle

 /usr/bin/ld: cannot find -lgmp 

你错过了linux库gmp-devel

此外, https://github.com/CocoaPods/CocoaPods/issues/1727表明以后的问题可能是由于捆绑程序无法在Linux机器上找到gcc版本。

您缺少构建依赖项。 请执行下列操作:

$ sudo apt-get update

$ sudo apt-get install build-essential

然后再次运行bundler。