Does anyone has the same error with jRuby? When I trying to install gem with C extension I have the next error:
gem install serialport Building native extensions. This could take a while... ERROR: Error installing serialport: ERROR: Failed to build gem native extension.
/home/username/.rvm/rubies/jruby-head/bin/jruby extconf.rb NotImplementedError: C > extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.
(root) at /home/username/.rvm/rubies/jruby-head/lib/ruby/shared/mkmf.rb:8
require at org/jruby/RubyKernel.java:1021 (root) at /home/username/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/custom_require.rb:1 (root) at extconf.rb:1
Any arguments declared in errors explanation does not give any success...
Info about installed jruby version: jruby 1.7.0.preview2.dev (1.9.3p203) 2012-08-05 22cd6f9 on Java HotSpot(TM) Server VM 1.7.0_05-b05 [linux-i386]
Platform: Linux
Gem: serialport
Ruby gems can have native extensions, which require compilation. When installing via Bundler, it's very common to install with the --jobs option, which launches each gem installation in a separate job (with the disclaimer that Ruby concurrency is limited).
Ruby native extensions are libraries written in C using the built-in functions of the RubyVM. Basically, it's C programming with a ton of functions and macros to interact with the virtual machine. Anything that can be achieved by using pure Ruby can also be implemented using the built-in instructions.
To install a gem, use gem install [gem] . Browsing installed gems is done with gem list . For more information about the gem command, see below or head to RubyGems' docs. There are other sources of libraries though.
A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.
As echristopherson as put it C extension support for JRuby is deprecated. In most gems you should find the Java specific version in RubyGems or a healthy alternative lyiing around in Github. I do not recommend you to try an hack the gem to work with jruby as it will be a world of pain...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With