How to enable C extension support in jRuby?

12,841

Solution 1

.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"

Solution 2

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

Share:
12,841

Related videos on Youtube

ada91
Author by

ada91

Updated on July 28, 2022

Comments

  • ada91
    ada91 over 1 year

    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?

    • fmendez
      fmendez over 10 years
      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.
    • Seanny123
      Seanny123 about 10 years
      It should be note that C extension support is looking at being eliminated in future versions of JRuby github.com/jruby/jruby/wiki/C-Extension-Alternatives
  • Daniel Antonio Nuñez Carhuayo
    Daniel Antonio Nuñez Carhuayo over 9 years
    in windows work fine too with: set JRUBY_OPTS="--1.9 -Xcext.enabled=true"
  • Pravin
    Pravin almost 7 years
    can we make it project specific setup rather than machine specific setup?