How to enable C extensions error in Jruby? - jruby

I am getting the following error and dont know how to solve this. Can someone simplify this process?
My Jruby is installed in
C:/jruby-1.7.13/bin
my project is in
C:/Users/myname/downloads/projectdirectory
The error is when I do
bundle install
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
c:/jruby-1.7.13/bin/jruby.exe extconf.rb
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS.
(root) at c:/jruby-1.7.13/lib/ruby/shared/mkmf.rb:8
require at org/jruby/RubyKernel.java:1065
(root) at c:/jruby-1.7.13/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
(root) at extconf.rb:2
Gem files will remain installed in c:/jruby-1.7.13/lib/ruby/gems/shared/gems/pg-0.17.0 for inspection.
Results logged to c:/jruby-1.7.13/lib/ruby/gems/shared/gems/pg-0.17.0/ext/gem_make.out
An error occurred while installing pg (0.17.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.0'` succeeds before bundling.

C- extensions are not really supported in JRuby and were actually dropped in the 1.7.x line ...
thus despite the message mentioning -Xcext.enabled=true won't help you!
since it's pg you're trying, there's a jruby alternative that uses a Java API instead of C pg_jruby, alternatively if you're using active-record look for activerecord-jdbc-adapter + jdbc-postgres

Related

libv8 fails on installation using jruby

I am trying to bundle install a sample rails 4 app and I am running into the following problem. libv8 fails on installation using jruby 1.7.18.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/kingslee/.rvm/rubies/jruby-1.7.18/bin/jruby extconf.rb
/home/kingslee/.rvm/rubies/jruby-1.7.18/lib/ruby/shared/mkmf.rb:14: Use RbConfig instead of obsolete and deprecated Config.
mkmf.rb can't find header files for ruby at /home/kingslee/.rvm/rubies/jruby-1.7.18/lib/native/include/ruby/ruby.h
Gem files will remain installed in /home/kingslee/.rvm/gems/jruby-1.7.18#app/gems/libv8-3.16.14.7 for inspection.
Results logged to /home/kingslee/.rvm/gems/jruby-1.7.18#app/gems/libv8-3.16.14.7/ext/libv8/gem_make.out
An error occurred while installing libv8 (3.16.14.7), and Bundler cannot
continue.
Make sure that `gem install libv8 -v '3.16.14.7'` succeeds before bundling.
I guess rubyrhino should solve the problem - https://github.com/cowboyd/libv8/issues/131

Installing ruby-oci8 with jruby

Trying to install ruby-oci8 with jruby gemset. It's giving me below error
I've tried to use export JRUBY_OPTS="--1.9 -Xcext.enabled=true" as suggested in other similar questions with no luck.
$ jruby -S gem install ruby-oci8
Fetching: ruby-oci8-2.1.7.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.
/home/user/.rvm/rubies/jruby-1.7.5/bin/jruby extconf.rb
/home/user/.rvm/rubies/jruby-1.7.5/lib/ruby/shared/mkmf.rb:14: Use RbConfig instead of obsolete and deprecated Config.
mkmf.rb can't find header files for ruby at /home/user/.rvm/rubies/jruby-1.7.5/lib/native/include/ruby/ruby.h
Gem files will remain installed in /home/oracle/.rvm/gems/jruby-1.7.5/gems/ruby-oci8-2.1.7 for inspection.
Results logged to /home/oracle/.rvm/gems/jruby-1.7.5/gems/ruby-oci8-2.1.7/ext/oci8/gem_make.out
We can use JDBC, instead of oci8. oci8 needs c extenssions which has been deprecated in jruby.
See this for a working example :: https://gist.github.com/rogerleite/217543

error installing caldecott

recently i made web application and want to atatch my database with it ..though i followed steps of doing it but still i am getting error ..i dont know where's problem i did in steps .. please let me know where i am wrong
please help me where i am wrong or what i skipped ..
thankyou..
I had problems install caldecott , i got the
ERROR: Error installing caldecott:
ERROR: Failed to build gem native extension.
"C:/Program Files/ruby-1.9.2/bin/ruby.exe" extconf.rb
*** extconf.rb failed ***
error :
i found this resource : http://www.clausconrad.com/blog/installing-caldecott-on-windows
which was helpfull but my problem was i had multiple ruby installations on my system !
so make sure you are using the right ruby installation and delete the others if needed :
i had :
C:/Program Files/ruby-1.9.2/bin/ruby.exe
and
C:\Ruby193\bin\ruby.exe
i deleted the first one and everything went fine , be sure to install the devkit like the link says , and everything should be allright.
There's an issue installing eventmachine on Windows. Try this instead:
gem install eventmachine --pre
gem install caldecott
To install Caldecott requires Ruby 1.9.2.
Check version by
ruby -v
if not 1.9
update the version and re try to install
first make sure that you installed C compiler in your local computer...
if you are using Linux you can run the following command:
sudo apt-get install g++
if you are in windows you will have find a C compiler from the net.
After installing this C compiler, you can now run
sudo gem install caldecott
If this is not working, try
ruby -v
to see if the version is 1.9.3 or above....
then repeat
hope that helps

Jruby openssl circular dependency

I did a fresh install of jruby 1.6.2, and then wanted to install some gems.
I ran this command:
jruby -S gem install cucumber
And got this error message:
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
LoadError: OpenSSL::SSL requires the jruby-openssl gem
(root) at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:8
use_ssl= at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:124
connection_for at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:267
request at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:349
open_uri_or_path at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:306
fetch_path at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:181
load_specs at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:251
load_specs at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:72
list at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:224
each at org/jruby/RubyArray.java:1602
list at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:220
list at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:63
find_matching_with_errors at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:143
find_matching_with_errors at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:54
fetch_with_errors at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:83
find_gems_with_sources at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:108
find_spec_by_name_and_version at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:212
install at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:244
execute at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:120
each at org/jruby/RubyArray.java:1602
execute at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:115
invoke at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/command.rb:278
process_args at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:133
run at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:103
run at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:63
(root) at /Users/Staffr02/Development/jruby-1.6.2/bin/gem:21
So then I tried this:
jruby -S gem install jruby-openssl
And I got the same error, which seemed a little odd. I'm running Mac OS 10.6.6.
I did some googling, and couldn't really find anything, except for a page that said this:
However, this breaks programs that use require 'openssl' as a test for whether openssl is available or not. Soap4r is one such program. In order to support this behavior, simply add
require 'jruby/openssl/gem_only'
So I tracked down the file that seemed to have the error (gem_runner.rb) and added the require line in there. I ran jruby -S gem install jruby-openssl again, and got this error:
ERROR: While executing gem ... (NameError)
uninitialized constant Net::HTTP::OpenSSL
Has anyone else had this problem before? I don't understand what I did wrong! Are there some independent openssl settings that I should delete first?
Any guidance would be much appreciated - thanks,
Rebecca

problem installing ruby-debug-ide gem with jruby 1.4.0

I tried to follow the UsingTheJRubyDebugger instructions on the jruby wiki. (kenai.com/projects/jruby/pages/UsingTheJRubyDebugger). I got an error trying to install the ruby-debug-ide gem.
jruby -S gem install --ignore-dependencies ruby-debug-ide
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://jruby.kenai.com/pages/JRuby_Builtin_OpenSSL
Building native extensions. This could take a while...
rake aborted!
Don't know how to build task '2>&1'
(See full trace by running task with --trace)
ERROR: Error installing ruby-debug-ide:
ERROR: Failed to build gem native extension.
I'm using Vista. Has anybody gotten this to work? Any help would be greatly appreciated.
hhh
JRuby does not support native extensions. A related stackoverflow question is here.
Second try:
There is bug report and a workaroud: set rake=jruby -S rake.