18

I want to install a gem but I get the following error:

Building native extensions.  This could take a while...
ERROR:  Error installing twitter-login:
        ERROR: Failed to build gem native extension.

        C:/nwcloud/jruby-1.7.2/bin/jruby.exe extconf.rb
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.

I also read this question with the same problem, but I don't even know how to enable the support with the three options because I don't know how to pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.

Can anybody help me with my beginner problem?

Community
  • 1
  • 1
ada91
  • 828
  • 2
  • 7
  • 19
  • Try reviewing this: http://stackoverflow.com/questions/8283300/how-do-i-use-jruby-opts-with-rvm – fmendez Apr 03 '13 at 19:41
  • Sorry, ..but I don't understand how I can adapt this to my problem. And I don't have .rvmrc in my project folder.. ? – ada91 Apr 03 '13 at 19:50
  • 1
    It was intended for you to read between the lines of all the solutions offered there. For instances, this example: `export JRUBY_OPTS="--1.9 -J-XX:+CMSClassUnloadingEnabled -J-XX:+UseConcMarkSweepGC -J-XX:MaxPermSize=256m -J-Xmx1024m"`, tells you that JRUBY_OPTS is a `environment` variable and one way to set its content is like that. Not all solutions come in a handy copy/paste format. – fmendez Apr 03 '13 at 19:55
  • I added a new system environment variable like this: variable: JRUBY_OPTS value: --1.9 -Xcext.enabled=true .. but it doesn't work. Do I have to create such a .rvmrc file ? – ada91 Apr 03 '13 at 20:21
  • 3
    It should be note that C extension support is looking at being eliminated in future versions of JRuby https://github.com/jruby/jruby/wiki/C-Extension-Alternatives – Seanny123 Sep 20 '13 at 02:23

2 Answers2

20

.jrubyrc edits suggested by Rodrigo didn't work for me (jdk 7u25 / JRuby 1.7.4), but exporting the JRUBY_OPTS did do the trick:

export JRUBY_OPTS="--1.9 -Xcext.enabled=true"
8

Make sure you are using the latest openjdk (7 update 21, at the time of this writing) and latest JRuby (1.7.4).

Create a file called .jrubyrc in your user home folder.

add the following;

cext.enabled=true

done

Rodrigo Dellacqua
  • 268
  • 1
  • 3
  • 12