Issue Type: Bug Bug
Affects Versions: JRuby 1.7.4
Assignee: Thomas E Enebo
Created: 02/Jul/13 11:05 AM
Description:

Running the following command:

jruby -rsocket -e 'UNIXServer.new("mysock.sock")'

produces the following stack trace:

NativeLibrary.java:87:in `loadNativeLibraries': java.lang.UnsatisfiedLinkError: /lib/libc.so.6: wrong ELF class: ELFCLASS32
	from NativeLibrary.java:70:in `getNativeLibraries'
	from NativeLibrary.java:49:in `getSymbolAddress'
	from NativeLibrary.java:59:in `findSymbolAddress'
	from AsmLibraryLoader.java:125:in `generateInterfaceImpl'
	from AsmLibraryLoader.java:63:in `loadLibrary'
	from NativeLibraryLoader.java:43:in `loadLibrary'
	from LibraryLoader.java:228:in `load'
	from Library.java:123:in `loadLibrary'
	from Library.java:80:in `loadLibrary'
	from Native.java:40:in `<clinit>'
	from Native.java:60:in `libsocket'
	from Native.java:68:in `socket'
	from UnixServerSocketChannel.java:38:in `<init>'
	from UnixServerSocket.java:29:in `<init>'
	from UnixServerSocketChannel.java:48:in `open'
	from RubyUNIXSocket.java:243:in `init_unixsock'
	from RubyUNIXServer.java:69:in `initialize'
	from RubyUNIXServer$INVOKER$i$1$0$initialize.gen:-1:in `call'
	from JavaMethod.java:968:in `call'
	from JavaMethod.java:674:in `call'
	from CachingCallSite.java:286:in `cacheAndCall'
	from CachingCallSite.java:81:in `callBlock'
	from CachingCallSite.java:85:in `call'
	from RubyClass.java:876:in `newInstance'
	from RubyIO.java:846:in `newInstance'
	from RubyIO$INVOKER$s$0$0$newInstance.gen:-1:in `call'
	from DynamicMethod.java:209:in `call'
	from DynamicMethod.java:205:in `call'
	from CachingCallSite.java:326:in `cacheAndCall'
	from CachingCallSite.java:170:in `call'
	from -e:1:in `__file__'
	from -e:-1:in `load'
	from Ruby.java:807:in `runScript'
	from Ruby.java:800:in `runScript'
	from Ruby.java:669:in `runNormally'
	from Ruby.java:518:in `runFromMain'
	from Main.java:390:in `doRunFromMain'
	from Main.java:279:in `internalRun'
	from Main.java:221:in `run'
	from Main.java:201:in `main'

Apparently, the 32-bit version of libc (located in /lib/libc.so.6) is loaded instead of its 64-bit counterpart (located in /lib64/libc.so.6). Since the JVM is 64-bit only, this doesn't work very well.

It used to work in JRuby 1.7.3, and using git bisect I narrowed it down to:

commit 7e066e7c0207a5ba145535d9d0c99ba9f7483267
Date:   Thu Apr 4 18:35:38 2013 +1000

    Update to jnr-ffi-1.0.4, (also version bump jnr-enxio-0.4, jnr-netdb-1.1.2, jnr-posix-2.5.2, jnr-unixsocket-0.3)

A simple workaround is to set java.library.path (the value doesn't seem to matter). I.e., the following works

jruby -J-Djava.library.path= -rsocket -e 'UNIXServer.new("mysock.sock")'
Environment: x86_64 GNU/Linux
Project: JRuby
Priority: Minor Minor
Reporter: Gustav Munkby
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to