为什么我无法安装 bcrypt?

为什么我无法安装 bcrypt?

我遇到了一个问题:当我尝试使用命令“bundle install”安装一些 Gem 时,我收到以下输出:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby2.1 -r ./siteconf20141210-5447-g6skes.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.1.0/gems/bcrypt-3.1.7 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/bcrypt-3.1.7/gem_make.out
An error occurred while installing bcrypt (3.1.7), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.7'` succeeds before bundling.

为什么?我该如何解决?

答案1

最近版本bcrypt-ruby似乎使用了 GMP 库。

类似这样的事情应该会有所帮助:

sudo aptitude install libgmp-dev

不要忘记安装所有用于开发的东西:

sudo aptitude install build-essential

相关内容