jrubyc fails with invokedynamic parameters in linux - ruby

I did everything well in window, but fail in linux.
What i want to do is to compile ruby script to java bytecode with -Xcompile.invokedynamic=true parameters:
[sxu3#** rubyscript]$ jrubyc -Xcompile.invokedynamic=true hello.rb
OptionParser::InvalidOption: invalid option: -Xcompile.invokedynamic=true
complete at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1542
catch at org/jruby/RubyKernel.java:1282
complete at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1540
parse_in_order at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1380
catch at org/jruby/RubyKernel.java:1282
parse_in_order at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1347
order! at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1341
permute! at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1432
parse! at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1453
compile_argv at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/shared/jruby/compiler.rb:83
initialize at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:882
compile_argv at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/shared/jruby/compiler.rb:35
(root) at /homes/sxu3/tools/jruby-1.7.10/bin/jrubyc:5
[sxu3#** rubyscript]$ jrubyc -Xcompile.invokedynamic=true hello.rb ^C
[sxu3#** rubyscript]$ which jrubyc
~/tools/jruby-1.7.10/bin/jrubyc
[sxu3#** rubyscript]$ jruby -v
jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on Java HotSpot(TM) Server VM 1.7.0_51-b13 [linux-i386]
[sxu3#** rubyscript]$
[sxu3#** rubyscript]$ uname -a
Linux .. 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Without -Xcompile.invokedynamic=true, jrubyc works but none of invokedynamic instruction is in generated bytecodes. Also,
"jrubyc -Xcompile.invokedynamic=true hello.rb"
works in window and i saw invokedynamic in class file in window.
I leave all other jrubyc properties(.jrubyrc) as default value
hello.rb is one line ruby script:
puts "hello world"
I also tried jrubyc 1.7.6 and the same errors . Anyone could provide some clue ?
[Update]:
Finally, I think the exception indicates jrubyc does not support -Xcompile.invokedynamic=true option. The jruby wiki page says jruby, instead of "jrubyc" can work with option.

I also had issues with jruby and invokedynamic. The problem is that invokedynamic is not really supported on JVM 1.7. To get it working you should install the JVM 1.8. You can read about the issues here: https://github.com/jruby/jruby/wiki/PerformanceTuning
But be careful when installing Java 8 - it's not so easy switching between versions and some programs like several eclipse IDEs don't want to run on that JVM.
However maybe jruby with invokedynamic works on Windows, because you have installed the Oracle JVM, which is a little bit different from the HotSpot OpenJDK version.

Related

sdkman installed grails 4.0.4, now grails is broken and wont start

I have some older version of grails installed (3.3.8), and tried to use sdkman to install a newer version (4.0.4). The install worked, but grails is now completely broken. i also updated java to 14 from the dmg from the oracle website. Basically grails is now completely broken. Any ideas how to fix?
mac 10.14.4
$ sdk version
SDKMAN 5.7.3+337
$ sdk current java
Not using any version of java
$ java -version
java version "14.0.2" 2020-07-14
Java(TM) SE Runtime Environment (build 14.0.2+12-46)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)
$ sdk current
Using:
groovy: 2.5.8
$ grails --version
| Grails Version: 3.3.8
| Groovy Version: 2.4.15
| JVM Version: 14.0.2
$ sdk install grails
Downloading: grails 4.0.4
In progress...
######################################################################## 100.0%
Installing: grails 4.0.4
Done installing!
Setting grails 4.0.4 as default.
$ sdk current
Using:
groovy: 2.5.8
$ grails --version
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
at org.codehaus.groovy.vmplugin.VMPluginFactory.<clinit>(VMPluginFactory.java:43)
at org.codehaus.groovy.reflection.GroovyClassValueFactory.<clinit>(GroovyClassValueFactory.java:35)
at org.codehaus.groovy.reflection.ClassInfo.<clinit>(ClassInfo.java:107)
at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:95)
at org.codehaus.groovy.reflection.ReflectionCache.<clinit>(ReflectionCache.java:39)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:209)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:107)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:85)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.bitwiseNegate(ScriptBytecodeAdapter.java:842)
at org.grails.config.NavigableMap.<clinit>(NavigableMap.groovy)
at org.grails.cli.GrailsCli.<clinit>(GrailsCli.groovy:77)
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
at org.codehaus.groovy.runtime.dgmimpl.NumberNumberMetaMethod.<clinit>(NumberNumberMetaMethod.java:33)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:124)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:346)
at java.base/java.lang.Class.newInstance(Class.java:604)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.createMetaMethodFromClass(MetaClassRegistryImpl.java:257)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:110)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:85)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.bitwiseNegate(ScriptBytecodeAdapter.java:842)
at org.grails.config.NavigableMap.<clinit>(NavigableMap.groovy)
at org.grails.cli.GrailsCli.<clinit>(GrailsCli.groovy:77)
I dont see an easy way to uninstall java 14, or go back in time.
echo $PATH
/Users/xx/.sdkman/candidates/groovy/current/bin:/Users/xx/.sdkman/candidates/grails/current/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Appz/apache-jmeter-5.3/bin:/usr/local/go/bin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/xx/go/bin:/Users/xx/dev/grails-3.3.8/bin:/Users/xx/dev/flutter/bin:/Users/xx/dev/gradle-5.1.1/bin:/appz/cassandra/bin
I am guessing I can try to hack the path etc, to fix.
This is my current .bash_profile:
vi .bash_profile
export JAVA_HOME=`/usr/libexec/java_home`
export GRAILS_HOME=/Users/xx/dev/grails-3.3.8
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
export PATH=$PATH:$GRAILS_HOME/bin
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
export GRADLE_HOME=/Users/xx/dev/gradle-5.1.1
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
PATH="${PATH}:/Users/xx/dev/flutter/bin"
PATH=$PATH:$GRADLE_HOME/bin
# Cassandra
if [ -d "/appz/cassandra" ]; then
export PATH="$PATH:/appz/cassandra/bin"
fi
export PATH
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/Users/simonh/.sdkman"
[[ -s "/Users/xx/.sdkman/xx/sdkman-init.sh" ]] && source "/Users/xx/.sdkman/bin/sdkman-init.sh"
~
This is odd, why is grails home still 3.3.8, when sdkman installed and made 4.0.4 current? Why didnt it edit the path? What version should I set gradle to? How do I go back to java 8, as I think there are bugs in java 14 which is causing issues with grails?
OK, figured it out.
First, I had to manually fix the java version.
To do this go to
$ /usr/libexec
$ ./java_home -V
This outputs one or more versions:
14.0.2, x86_64: "Java SE 14.0.2" /Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home
1.8.0_131, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Now edit our .bash_profile and replace the JAVA_HOME line with the version you want, either the whole thing (1.8.0_131) or just the major (1.8) thusly:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
Now when you open a new window, and do "java -version" you get 1.8, and when you do "grails -version" I finally get 4.0.4.
Yay!
The strange part is that just changing JAVA_HOME should not affect whats on the path, but it seems to. i.e. just setting JAVA_HOME should not affect what version of java is run when I type in "java", but it does. i.e. there is no line suchy as "PATH=$PATH:$JAVA_HOME/bin in muy bash_profile.

DB2 db2prereqcheck how to make it work?

I'm newbie in DB2 database administration and I couldn't think that I'd be stuck with the installation process. I read some documents before installation and found an interesting "db2prereqcheck" thing.
So I tried to run it before installation and got an error:
DBT3505E The db2prereqcheck utility was unable to determine the Linux distribution level.
About this error from ibm:
IBM Knowledge Center: DBT3505E
IBM Support: db2prereqcheck fails checking Linux distribution
I found some other answers where suggest to delete the files "/etc/issue" and "/etc/issue.net".
I checked my "/etc/issue*" files according to the tips. I filled that files with the example from the article in IBM Support, but nothing has changed. I tried running this script on other servers with CentOS, Debian operating systems, but got another error:
./db2prereqcheck
DBI1189E There has been an attempt to use db2prereqcheck
on an image for a platform that does not match the current platform
'Linux/x86-64' on which it is being run.
Explanation:
Possible causes include:
- This DB2 install image is not valid for the current
platform.
- The current platform is not supported by DB2.
User Response:
Install DB2 using the DB2 install image that corresponds
with the current platform 'Linux/x86-64'.
I've already installed db2, but my self-esteem is down. So the question is: my hands are a problem or is the problem in another? And how to make db2 work
Technical details:
cat /etc/issue
Amazon Linux AMI release 2018.03
Kernel \r on an \m
cat /etc/*-rel*
NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2018.03
cpe:/o:amazon:linux:2018.03:ga
uname -a
Linux hostname.host 4.14.47-56.37.amzn1.x86_64 #1 SMP Wed Jun 6 18:49:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
As you may have noticed, this is an EC2 instance.
DB2 versions:
IBM® Db2 11.1 Developer-C Edition for Linux® on AMD64 and Intel® EM64T systems (x64)
IBM® DB2 Express-C Version 11.1
I would appreciate your help in this matter. Thank you for your time.
If db2prereqcheck reports :
DBT3505E The db2prereqcheck utility was unable to determine the Linux
distribution level. Aborting the current installation ... Run
installation with the option "-f sysreq" parameter to force the
installation.
and if other IBM suggestions do not apply, then you may be able to avoid this symptom with the following workaround:
(as root)
cp /etc/os-release /etc/lsb-release
The reason it works is that some versions of db2prereqcheck look only for the following files in turn:
/etc/centos-release
/etc/redhat-release
/etc/SuSE-release
/etc/lsb-release
If none of those files are present, the DBT3505E symptom can result.
If your distro (or container) has an equivalent file (for example, Debian may have /etc/os-release) then simply copying it to /etc/lsb-release will allow db2prereqcheck to complete.
db2prereqcheck checks and understands only /etc/SuSE-release with the following content:
SUSE Linux Enterprise Server 15 (x86_64)
VERSION = 15
PATCHLEVEL= 1
This works also with OpenSuse Leap 15.1. This file is deprecated since SLES 12. So you must create it your self. Then run db2prereqcheck and install all missing libraries and kernel sources mentioned. Having all requirements fulfilled you may finally see the segmentation fault message:
Validating "Intel TCO WatchDog Timer Driver modules" ...
DBT3546E The db2prereqcheck utility failed to determine whether the
following file or package exists: "".
Segmentation fault (core dumped)
Don't worry!
Simply retest with db2prereqcheck -i. The -i parameter checks for prerequisites that are not Db2 pureScale related. If we don't install pureScale and all requirement are fulfilled, we can ignore this ugly segmentation fault.
Otherwise you must blacklist by adding:
blacklist iTCO_wdt
blacklist iTCO_vendor_support
Into the file /etc/modprobe.d/blacklist.conf
A further issue is related to:
export DISPLAY=your.machine.ip:0.0
running ./db2setup as root doesn't work.
./db2_install is deprecated, but it works.
First create the db2 users and groups as described by the IBM Knowledge Center.
Then run ./db2_install as root, followed by creating an instance using db2icrt.
Login as db2inst1 and test as described by the IBM Knowledge Center eventually creating the SAMPLE Database, etc. Normally "first steps" would do the job, but it crashes with javascript error. Hence you must do it manually!
Additional manual configuration may be required as opening the firewall for port 50001 and setting this port within /etc/services and within dbm cfg with:
db2 update dbm cfg using SVCENAME 50001
or
db2 update dbm cfg using SVCENAME db2c_db2inst1
If you use the latter you must update /etc/services with the line:
db2c_db2inst1 50001/tcp #and a comment like db2 tcp/ip
connection port.

Upstart causes kernel panic on embedded Linux

I am using ptxdist to create kernel and rootfs images for a Linux embedded system, running on an ARM Cortex A8 CPU.
I was trying to use a newer compiler (GCC 5+) and so was forced to upgrade several external packages that would not compile under the new GCC.
I compiled the following versions of Upstart and its immediate dependencies:
upstart: 1.13.2
libnih: 1.0.3
dbus: 1.11.2
json-c: 0.12.1
When I boot, I get the following message:
init: com.ubuntu.Upstart.c:3525: Assertion failed in control_emit_event_emitted: env != NULL
init: Caught abort, core dumped
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000600
Searching online did not yield useful hints - the only relevant issue I found is this, but it is relevant to an older version of Upstart, and my libnih is of the correct version already.
According to comment #8 in the bug report you linked, it is not enough to use version 1.0.3 of libnih -- you have to specifically use the Ubuntu version, as this seems to include dbus fixes which could solve the problem you are seeing. From the bug report:
David Ireland (e-david) wrote on 2013-04-22: #7
I've built libnih
1.0.3 from source and also made sure that upstart builds with that version of the nih-dbus-tool. I'm still having this problem.
James Hunt (jamesodhunt) wrote on 2013-04-22: #8
Which problem? The
crash? If so, you are still using the wrong version of libnih: you
should be using the Ubuntu version (specifically 1.0.3-4ubuntu16) from
here:
https://code.launchpad.net/~ubuntu-branches/ubuntu/raring/libnih/raring
You do not need the --session flag to run a "Session Init" (yes, this
is a little confusing but --session was added for testing a long time
ago and is still required for that). A "Session Init" only requires
"--user".

grunt serve - returns -> org/jruby/RubyFile.java: No such process

I built a test project with yo angular.
When I run grunt serve -v, using jruby 1.7.18 on Windows 7, compass fails with the following error
Running "concurrent:server" (concurrent) task
[D] Task source: test\node_modules\grunt-concurrent\tasks\concurrent.js
Verifying property concurrent.server exists in config...OK
Files: [no src] -> server
Options: limit=2
Warning: Errno::ESRCH on line ["941"] of org/jruby/RubyFile.java: No such process - test/.tmp/styles/main.css
Diving into the grunt code, it seems that the problem is related to the way jruby instantiate the compass process on Windows 7, but I can't figure out exactly how is done...
If I run the same command using Windows 7+jruby 1.7.15 or OS X+jruby 1.7.18 everything goes fine.
My setup is:
Windows 7 SP1
Java SE (build 1.8.0_25-b18) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
jruby 1.7.18 (1.9.3p551)
npm 2.1.18
grunt-cli v0.1.13
grunt v0.4.5

Aptana version 3.4.2.201308081805 crash

I have Aptana version 3.4.2.201308081805 on Linux Mint 15 64bit
was open just once and now anytime when I want to start the Aptana crash
here is the one from a few crash log:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGBUS (0x7) at pc=0x00007fab6e08a938, pid=4403, tid=140373276522240
#
# JRE version: 7.0_25-b30
# Java VM: OpenJDK 64-Bit Server VM (23.7-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libzip.so+0x4938] Java_java_util_zip_ZipFile_getZipMessage+0x8d8
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
# https://bugs.launchpad.net/ubuntu/+source/openjdk-7/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Don't use OpenJDK
Use Java 7 from the wbupd8 repository
sudo apt-add-repository ppa:webupd8team/java
Prerequirements
sudo apt-get install software-properties-common
If you got problems with SWT take a look at
Eclipse cannot load SWT libraries
I managed to fix this issue by removing openjdk and installing oracle jdk.
The step by step instruction is provided in the following article
http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linux
so far no crash in aptana.
FYI: I am using lubuntu

Resources