bcrypt-ruby不会与bundler一起安装,但可以与gem install一起使用

我刚刚开始遇到捆绑包问题 – 在进行捆绑安装或sudo捆绑安装时,bcrypt-ruby将无法安装,并退出时出现以下错误:

Installing bcrypt-ruby (2.1.4) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb Gem files will remain installed in /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4 for inspection. Results logged to /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4/ext/mri/gem_make.out An error occured while installing bcrypt-ruby (2.1.4), and Bundler cannot continue. Make sure that `gem install bcrypt-ruby -v '2.1.4'` succeeds before bundling. 

但是, gem install bcrypt-ruby -v '2.1.4'运行得很好(事实上已经在这个盒子上运行)。 手动运行/usr/bin/ruby1.8 extconf.rb工作得很好,生成的Makefile也可以运行make就好了。

我在Ubuntu 10.04.1 LTS上使用Ruby 1.8.7和bundler 1.0.21。 其他gem似乎通过捆绑器正常工作。 虽然这可能很明显,但我已经确认安装了ruby-dev,gcc等软件包。 我尝试使用带有bundler的–deployment选项,没有不同的行为。 我最近唯一想到的改变就是几天前我做了一个捆绑更新,所以捆绑包得到了一个小版本更改(1.0.10 – > 1.0.21)并且bcrypt似乎得到了一个主要的版本更改(2.1 .4 – > 3.0.1)。

任何帮助表示赞赏!

您是否在安装Ruby 1.9.2后升级到Lion? 如果是这样,它可能与错误的gcc有关。

尝试卸载并重新安装1.9.2,我建议使用rvm

 rvm uninstall 1.9.2 rvm install 1.9.2 

如果这不起作用,你可能不得不破坏rvm

 rvm implode bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) source ~/.bash_profile rvm install 1.9.2 

尝试:

 sudo apt-get install build-essential