2

When I try to install cucumber 0.93 this error is triggered. I need to install this specific version.

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
Dave Schweisguth
  • 31,916
  • 10
  • 88
  • 112
juan perez
  • 323
  • 5
  • 14

3 Answers3

1

I had the same issues, thanks to user2707671 I did

sudo yum install ruby-devel

and the ran

gem install cucumber 
fatherdamo
  • 155
  • 2
  • 10
0

The problem is that your version of gcc is issuing a warning (and treating it as an error, which breaks the compile) that older versions of gcc did not issue. You can address this in a couple of ways:

  • Use an older gcc. (I don't know exactly what versions would work; you'd have to experiment.)

  • Fork the gherkin gem and change it to not use the -Werror flag. I used this approach a few years ago when I was stuck on an old Cucumber and described it in this blog post. Briefly:

    • Fork it
    • Remove the -Werror flag from tasks/compile.rake
    • Install Ragel and the jeweler and rake-compiler gems
    • run rake gems:posix
    • remove gherkin.gemspec and ext from .gitignore
    • add the generated code to your fork
    • reference the fork in your Gemfile:

      gem 'gherkin', '1.0.30', :git => 'git@github.com:fandor/gherkin.git', :branch => 'v1.0.30-no-Werror'
      

    You might even be able to just use my fork, if the gherkin that I forked is compatible with your Cucumber.

Dave Schweisguth
  • 31,916
  • 10
  • 88
  • 112
0

This command solved the problem for me:

sudo apt-get install ruby1.9.1-dev

See this related answer:

Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)

Community
  • 1
  • 1
user2707671
  • 1,475
  • 12
  • 11