我刚刚设置了一个 Ubuntu 13.04 服务器,并安装了 RVM 1.21.11、Ruby 1.9.3-p448 和 Rubygems 2.0.5。
许多 gem,例如mongo、awesome_print、aws-s3和json,安装成功。
但是,编译扩展的 gem 会失败。我尝试安装nokogiri、mongo_ext和bson_ext。它们都以相同的方式失败,如下所示。
知道如何解决这个问题吗?
[nick@mongo01 ~] gem install mongo_ext -u -V --backtrace
HEAD http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
HEAD http://production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
Installing gem mongo_ext-0.19.3
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/mongo_ext-0.19.3/Rakefile
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/mongo_ext-0.19.3/mongo-extensions.gemspec
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/mongo_ext-0.19.3/ext/cbson/extconf.rb
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/mongo_ext-0.19.3/ext/cbson/buffer.c
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/mongo_ext-0.19.3/ext/cbson/cbson.c
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/mongo_ext-0.19.3/ext/cbson/encoding_helpers.c
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/mongo_ext-0.19.3/ext/cbson/buffer.h
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/mongo_ext-0.19.3/ext/cbson/encoding_helpers.h
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/mongo_ext-0.19.3/ext/cbson/version.h
Building native extensions. This could take a while...
/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for asprintf()... yes
checking for ruby/st.h... yes
checking for ruby/regex.h... yes
checking for ruby/encoding.h... yes
creating Makefile
make "DESTDIR="
compiling encoding_helpers.c
compiling buffer.c
compiling cbson.c
cbson.c: In function 'write_utf8':
cbson.c:80:36: warning: pointer targets in passing argument 1 of 'check_string' differ in signedness [-Wpointer-sign]
In file included from cbson.c:46:0:
encoding_helpers.h:26:10: note: expected 'const unsigned char *' but argument is of type 'char *'
cbson.c: In function 'objectid_generate':
cbson.c:858:5: warning: implicit declaration of function 'htonl' [-Wimplicit-function-declaration]
cbson.c:867:5: warning: implicit declaration of function 'htons' [-Wimplicit-function-declaration]
cbson.c: In function 'write_element':
cbson.c:264:17: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result]
linking shared-object mongo_ext/cbson.so
make "DESTDIR=" install
/usr/bin/install -c -m 0755 cbson.so /usr/local/rvm/gems/ruby-1.9.3-p448/gems/mongo_ext-0.19.3/ext/cbson/.gem.20130718-9545-1ue92ws/mongo_ext
installing default cbson libraries
ERROR: While executing gem ... (NoMethodError)
undefined method `join' for nil:NilClass
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:685:in `rescue in block in build_extensions'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:675:in `block in build_extensions'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:653:in `each'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:653:in `build_extensions'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:218:in `install'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:371:in `block in install'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:331:in `each'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:331:in `each_with_index'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:331:in `install'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb:166:in `block in execute'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb:158:in `each'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb:158:in `execute'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/command.rb:305:in `invoke_with_build_args'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:170:in `process_args'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:130:in `run'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:60:in `run'
/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/gem:21:in `<main>'
[nick@mongo01 ~]
[nick@mongo01 ~] gem -v
2.0.5
[nick@mongo01 ~] ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
[nick@mongo01 ~] rvm -v
rvm 1.21.11 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]