1)执行
bundle install --without development test rmagick
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from extconf.rb:1:in `<main>' Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.1 for inspection. Results logged to /var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out An error occurred while installing json (1.8.1), and Bundler cannot continue. Make sure that `gem install json -v '1.8.1'` succeeds before bundling.检查之后, 确认需要安装 ruby1.9.1-dev.
执行:
sudo aptitude install ruby1.9.1-dev之后,重新执行上面的 bundle程序,还是报错,不过这次不同了:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb checking for ruby/thread.h... no checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/var/lib/gems/1.9.1/gems/mysql2-0.3.16/ext/mysql2/mkmf.log/or headers. Check the mkmf.log file for more details. You may need configuration options.检查一下 /var/lib/gems/1.9.1/gems/mysql2-0.3.16/ext/mysql2/mkmf.log,发现有:
have_header: checking for ruby/thread.h... -------------------- no需要安装
sudo aptitude install libmysqld-dev之后,再执行bundle 安装程序,就可以了:
Your bundle is complete! Gems in the groups development, test and rmagick were not installed. Use `bundle show [gemname]` to see where a bundled gem is installed.