After a clean install of jRuby 1.5.5, I cannot run jruby -v from the command line without getting the following error:
jruby: unknown option --disable-gems
I didn't specify that option so I don't know where it's coming from.
This also precludes me from using jruby in Netbeans.
Any ideas?
-Jim
It was completely my oversight. I had added the --disable-gems as an environment variable in an attempt to speed up rails on a windows machine. I completely forgot.
Related
I tried a lot of things I read on documentations or tutorials... But I still can't cross-compile Qt with the MySQL library driver. Story begins:
I have to cross-compile Qt from Linux to Windows (32bits) using MinGW (i686-w64-mingw32- prefix to be precise). I downloaded qtbase-opensource-src-5.9.4 and started to work like that:
$ ./configure -prefix [...]/qt-5.9.4 -xplatform win32-g++ -device-option CROSS_COMPILE=/usr/bin/i686-w64-mingw32- -opengl desktop -no-sql-odbc -sql-sqlite -enable-shared -nomake examples -nomake tests -release
And it worked. Then, make and make install worked too. But I figured out that there was only the SQLite ".dll" in the plugins/sqldrivers repository. So I tried to compile the MySQL driver and... How can I do that?? If I add -sql-mysql to my ./configure ... call, I have to following error:
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
I downloaded MySQL library from the official website to get mysql-5.7.21-win32.zip. But how to link it with qtbase sources? Adding MYSQL_INCDIR=[...]/mysql-5.7.21-win32/include and MYSQL_LIBDIR=[...]/mysql-5.7.21-win32/lib or just MYSQL_PREFIX=[...]/mysql-5.7.21-win32 to my ./configure ... command results to the same error message.
Any idea please?
EDIT:
I tried to compile the driver like that (with the qmake I built previously):
$ cd qtbase-opensource-src-5.9.4/src/plugins/sqldrivers/mysql
$ [/*prefix of my previous build*/]/qt-5.9.4/bin/qmake .
And the result is:
Project ERROR: Library 'mysql' is not defined.
Ok everyone, I found the solution: do a clean checkout or add -recheck-all to the ./configure command when you want to add a lib like MySQL in my case. Easy isn't it? To make it clear, here is the command I used:
./configure -prefix [...] -xplatform win32-g++ -device-option CROSS_COMPILE=/usr/bin/i686-w64-mingw32- -opengl desktop -no-sql-odbc -sql-sqlite -plugin-sql-mysql MYSQL_PREFIX=[...] -enable-shared -nomake examples -nomake tests -release -recheck-all
That was just a refresh problem, but I prefer to let this answer because it's pretty hard to realize.
Instead of what you tried in your EDIT, should I think be:
$ cd qtbase-opensource-src-5.9.4/src/plugins/sqldrivers
qmake -- MYSQL_PREFIX= [...]/mysql-5.7.21-win32/include
Per http://jruby.org/2014/01/09/jruby-1-7-10.html, the subject problem is supposed to be fixed in 1.7.10 via https://github.com/jruby/jruby/pull/1252. However, my experience is otherwise, per:
MacbookAir1:javlats palfvin$ jruby -v
jruby 1.7.10 (2.0.0p195) 2014-01-09 c4ecd6b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_65-b14-462-11M4609 [darwin-x86_64]
MacbookAir1:javlats palfvin$ jruby
(1..2).size
NoMethodError: undefined method `size' for 1..2:Range
(root) at -:1
MacbookAir1:javlats palfvin$
I haven't figured out how to look at the Java code in an installed JRuby version, so I wasn't able to compare the installed Java source code to the version on github, but this seems so basic it's hard to believe there's anything in my environment that is messing it up. I Googled to see if anyone else had encountered this, but didn't find anything.
Any ideas?
If my git-fu is right, I don't think this commit was included in 1.7.10. Indeed, it looks to only be in master:
$ git show -s --oneline 01be8f85522e4da8df3968e622fa2c947ea6712c
01be8f8 Add a size method to RubyRange to resolve #1252
$ git branch -r --contains 01be8f85522e4da8df3968e622fa2c947ea6712c
upstream/master
upstream/unbox_opts
$ git tag --contains 01be8f85522e4da8df3968e622fa2c947ea6712c
Perhaps there was a confusing merge somewhere in JRuby land?
I just recently learned about Vert.x and would like to try it out but I am running into some issues.
I can get a server up written in javascript but cannot get the ruby (jruby) version to run.
May 04, 2012 1:50:57 PM org.vertx.java.core.logging.impl.JULLogDelegate error
SEVERE: backtrace is
/home/curtis/.rvm/rubies/jruby-1.6.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
require'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:13:in
Ext'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:12:in
JSON'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:9:in
(root)'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:36:in
require'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json.rb:58:in
JSON'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json.rb:54:in
(root)'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json.rb:59:in
require'
/home/curtis/src-files/vert.x-1.0.beta11/bin/../lib/ruby/core/event_bus.rb:16:in
(root)'
/home/curtis/src-files/vert.x-1.0.beta11/bin/../lib/ruby/core/event_bus.rb:26:in
(root)'
/home/curtis/src-files/vert.x-1.0.beta11/bin/../lib/ruby/vertx.rb:1:in
`(root)'
This is what happens when I try to simply run the webapp example located in the vert.x-1.0.beta11/examples/ruby/webapp directory. I do have Jruby installed (through rvm)
$ jruby-1.6.6 -v jruby 1.6.6 (ruby-1.8.7-p357) (2012-01-30 5673572)
(OpenJDK Client VM 1.7.0_147-icedtea) [linux-i386-java]
I also have the reccomended JDK/JRE version installed. With the correct paths
.bashrc (bottom)
PATH=$PATH$HOME/.rvm/bin:$HOME/src-files/vert.x-1.0.beta11/bin:/usr/lib/jvm/java-1.7.0-openjdk-i386
I am running into a brick wall sort of, the error messages either don't help much or lead me to believe there is simply a bug in vert.x or jruby.
Advice please?
JRUBY_HOME=$HOME/.rvm/rubies/jruby-1.6.6
Make sure you have json gem installed, it's a prerequisite for the running the ruby version as stated on the vert.x website. Since you're using rvm you can switch to jruby, rvm use [jruby-version] if you've not already and try searching for the json gem as shown below.
gem search json
What is the result when you issue the command above. If you didn't get any response, you can get it installed in your jruby by using this command,
jruby -S gem install json
On the lighter side you should also install yard gem if you want to build the ruby API doc. Hope this helps.
Is the PATH line in your .bashrc just as you wrote here? If so, you need a slash in between $PATH and $HOME. Also, I think rvm likes to have the rvm sourcing line as the last thing in .bashrc, like the following:
# RVM -- don't put anything after this.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
So, I have rvm installed on my machine, and I type:
rvm install jruby
Everything looks good at first, but eventually I get:
jruby-1.5.6 - #fetching
jruby-1.5.6 - #extracted to /home/jenny/.rvm/src/jruby-1.5.6 (already extracted)
Building Nailgun
jruby-1.5.6 - #installing to /home/jenny/.rvm/rubies/jruby-1.5.6
jruby-1.5.6 - #importing default gemsets (/home/jenny/.rvm/gemsets/)
Copying across included gems
Exception in thread "main" java.lang.NoClassDefFoundError: org.jruby.Main
at gnu.java.lang.MainThread.run(libgcj.so.9)
Caused by: java.lang.ClassNotFoundException: org.jruby.Main not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.9)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.9)
at java.lang.ClassLoader.loadClass(libgcj.so.9)
at java.lang.ClassLoader.loadClass(libgcj.so.9)
at gnu.java.lang.MainThread.run(libgcj.so.9)
jenny#linux-auvv:~/workspace/pcms_stable>
I have absolutly no context for debugging this... I honestly have no idea what to do...
I'm on OpenSuse, and when I type "java -version", I get:
java version "1.6.0_0"
OpenJDK Runtime Environment (build 1.6.0_0-b11)
OpenJDK Server VM (build 1.6.0_0-b11, mixed mode)
I can't see any references to java requirements for JRuby, though...
As far as RVM, I'm running:
rvm 1.2.4 by Wayne E. Seguin (wayneeseguin#gmail.com) [http://rvm.beginrescueend.com/]
I can install other rubies with RVM (1.9.2, 1.8.7, that sort of thing) with no problem, this is the first issue I've ever found.
It doesn't seem to matter WHICH jruby I install, either. My rvm knows about:
# JRuby
jruby-1.2.0
jruby-1.3.1
jruby-1.4.0
jruby[-1.5.6]
jruby-head
I don't even get the same errors for each one of them:
For 1.2.0, 1.3.1, 1.4.0 I get:
Fatal: GCJ (GNU Compiler for Java) is not supported by JRuby.
Where 1.5.6 and head get me the error I mentioned first.
I WANT to use JRuby with Rails 3, so I'm figuring I want the newest version I can get (which is having the exceptions)
Is there ANYTHING I can do, or am I just doomed to not be able to use RVM for my purposes?
EDIT:
I have confirmed that it's not just RVM, it is JRuby that is to blame. To test, I downloaded JRuby without rvm at all, through the website (I chose version 1.6). I unpacked it as per the instructions, and typed:
bin/jruby -v
in the extracted directory.
I got the exact same error:
jenny#linux-auvv:~/jruby-1.6.0.RC1> bin/jruby -v
Exception in thread "main" java.lang.NoClassDefFoundError: org.jruby.Main
at gnu.java.lang.MainThread.run(libgcj.so.9)
Caused by: java.lang.ClassNotFoundException: org.jruby.Main not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.9)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.9)
at java.lang.ClassLoader.loadClass(libgcj.so.9)
at java.lang.ClassLoader.loadClass(libgcj.so.9)
at gnu.java.lang.MainThread.run(libgcj.so.9)
So, still have no clue what's going on, but at least I know now it's a jruby issue, and not an rvm one (though I still WANT it installed through rvm)
Edit:
So, I tried updating my OpenJDK, and it was no dice, but I found ANOTHER version of OpenJDK (that I didn't have installed) through YAST, and installed THAT one, and suddenly my manually installed jruby works just fine:
jenny#linux-auvv:~/jruby-1.6.0.RC1> bin/jruby -v
jruby 1.6.0.RC1 (ruby 1.8.7 patchlevel 330) (2011-01-10 769f847) (OpenJDK Client VM 1.6.0_0) [linux-i386-java]
When I type java -version, I even get something different:
jenny#linux-auvv:~/jruby-1.6.0.RC1> java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6.2) (suse-0.1.1-i386)
OpenJDK Server VM (build 14.0-b16, mixed mode)
It even works in RVM, so hooray!
I would try installing the Sun JRE/JDK.
Or perhaps you could reinstall OpenJDK(probably the easiest way to reset it to being the default on your system).
Update:
To change the default java do this. First check which Javas are available:
update-alternatives --list java
To actually change which one you are using do this:
update-alternatives --config java
I think the clue is in this:
Fatal: GCJ (GNU Compiler for Java) is not supported by JRuby.
For whatever reason, your system is configured to fire up GCJ instead of your OpenJDK compiler. Check the docs on your system for how it handles the case where multiple things can provide the same service name (multiple versions of compilers, for example, or multiple interpreters) and see what you can do to have OpenJDK be the default handler for Java compilation and execution.
I've downloaded the dbd-mysql-0.4.4.zip and linked it to my project. While I try to run a demo code from NetBeans the very first line (shown below) gives me an error. Is there a different way to do it?
require "dbi";
I also tried this command from the command prompt:
jruby setup.rb config --with=dbi,dbd_mysql
It gave me the following error:
config: unknown option --with=dbi,dbd_mysql
Try ruby setup.rb --help for detailed usage.
Any suggestions please?
If you're working with jruby, you need to use dbd-jdbc, because dbd-mysql depends on mysql a native extension (written in C) for Matz' Ruby interpreter.
Install it using rubygems: jruby -S gem install dbi, and add require 'rubygems' as the first line of your code.