BSON_EXT 1.7.0使用Bundle时无法在Linux上构建:安装Capistrano任务



这是错误消息:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
Gem files will remain installed in /var/www/app_dir/shared/bundle/ruby/1.8/gems/bson_ext-1.7.0 for inspection.
Results logged to /var/www/app_dir/shared/bundle/ruby/1.8/gems/bson_ext-1.7.0/ext/cbson/gem_make.out
An error occured while installing bson_ext (1.7.0), and Bundler cannot continue.
Make sure that `gem install bson_ext -v '1.7.0'` succeeds before bundling.

我尝试运行gem install bson_ext -v '1.7.0',但没有错误。我尝试安装ruby-devruby1.8-dev APT软件包,这无济于事。

bundle install能够在我的Mac OS X开发系统上成功构建bson_ext,但是即使我直接在capistrano bundle:install任务的上下文之外运行它,也会在Linux生产环境中失败。

我也尝试运行gem update --systemgem update bundler,这无济于事。

我怀疑这个问题在于目标系统如何调用bundle install。尽管如此,我还是尝试将Capistrano更新为2.13.5版,这没有帮助。

因此,看来bundler 1.2.1无法在我的系统上构建以下宝石:

  • bson_ext 1.7.0
  • curb 0.8.3
  • nokogiri 1.5.5
  • json 1.7.5
  • therubyracer 0.8.2。

我能够使用gem install <GEMNAME> -v '<VERSION>' --install-dir /var/www/<APP_DIR>/shared/bundle/ruby/1.8/构建这些。之后,运行bundle exec capistrano deploy成功。

bundle似乎无法在我的系统上使用本机扩展构建GEM。不确定为什么,但也许此过程将有助于有类似问题的人。

最新更新