Ruby on rails &引用;错误:未能生成gem本机扩展“;安装Cucumber 0.93时
当我尝试安装cucumber 0.93时,会触发此错误。 我需要安装这个特定的版本Ruby on rails &引用;错误:未能生成gem本机扩展“;安装Cucumber 0.93时,ruby-on-rails,ruby,cucumber,ruby-1.8.7,Ruby On Rails,Ruby,Cucumber,Ruby 1.8.7,当我尝试安装cucumber 0.93时,会触发此错误。 我需要安装这个特定的版本 trabajo@fernando-Inspiron-1545:~/cucumber-rspec$ gem install cucumber -v 0.9.3 Building native extensions. This could take a while... ERROR: Error installing cucumber: ERROR: Failed to build gem native
trabajo@fernando-Inspiron-1545:~/cucumber-rspec$ gem install cucumber -v 0.9.3
Building native extensions. This could take a while...
ERROR: Error installing cucumber:
ERROR: Failed to build gem native extension.
/home/trabajo/.rvm/rubies/ruby-1.8.7-p334/bin/ruby extconf.rb
checking for main() in -lc... yes
creating Makefile
make
gcc -I. -I. -I/home/trabajo/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/i686-linux -I. -D_FILE_OFFSET_BITS=64 -fPIC -g -O2 -fPIC -O0 -Wall -Werror -c gherkin_lexer_ar.c
/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/ar.c.rl: En la función ‘CLexer_scan’:
/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/ar.c.rl:199:29: error: la comparación siempre se evalúa como ‘true’ para la dirección de ‘raise_lexer_error’ que nunca será NULL [-Werror=address]
/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/ar.c.rl:199:29: error: la comparación siempre se evalúa como ‘true’ para la dirección de ‘raise_lexer_error’ que nunca será NULL [-Werror=address]
cc1: all warnings being treated as errors
make: *** [gherkin_lexer_ar.o] Error 1
问题是您的gcc版本发出了一个警告(并将其视为一个错误,导致编译中断),而旧版本的gcc没有发出警告。您可以通过以下两种方式解决此问题:
- 使用旧的gcc。(我不知道什么版本能起作用;你必须进行实验。)
- 叉上小黄瓜宝石,并将其改为不使用-Werror标志。几年前,当我被困在一根老黄瓜上时,我使用了这种方法,并在一篇文章中描述了它。简而言之:
- 叉
- 从tasks/compile.rake中删除-Werror标志
- 安装Ragel和jeweler以及rake编译器gems
- 运行rake gems:posix
- 从.gitignore中删除gherkin.gemspec和ext
- 将生成的代码添加到fork中
- 引用文件中的fork:
gem 'gherkin', '1.0.30', :git => 'git@github.com:fandor/gherkin.git', :branch => 'v1.0.30-no-Werror'
sudo apt-get install ruby1.9.1-dev
请参阅以下相关答案:
多亏了用户2707671,我也遇到了同样的问题
sudo yum install ruby-devel
然后就跑了
gem install cucumber