LWJGL on Linux 64-bit (Ubuntu AMD64, NetBeans, Sun Java 6 64-bit)

Started by paulscode, March 09, 2010, 01:41:55

Previous topic - Next topic

paulscode

I recently changed my OS to Ubuntu 64-bit, and I am trying to get LWJGL to work in the NetBeans IDE.  I have it using the VM option to point to the directory where I have the Linux native .so files sitting:
-Djava.library.path=/sharedrive/libs/LWJGL_natives/linux


However, when I try to run an application, I get the following error message:
QuoteException in thread "Thread-3" java.lang.UnsatisfiedLinkError: /sharedrive/libs/LWJGL_natives/linux/liblwjgl.so: /sharedrive/libs/LWJGL_natives/linux/liblwjgl.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
This would seem to indicate a problem with 32-bit vs. 64-bit.

I also tried removing the 32-bit .so files and renaming the other 64-bit .so files (liblwjgl64.so to liblwjgl.so, etc) just to see if that would do anything, but then I just get a different error message:
QuoteException in thread "Thread-3" java.lang.UnsatisfiedLinkError: /sharedrive/libs/LWJGL_natives/linux/liblwjgl.so: /sharedrive/libs/LWJGL_natives/linux/liblwjgl.so: failed to map segment from shared object: Operation not permitted

I've seen that this problem has been solved before by installing a 32-bit JVM.  However, I would like to get LWJGL applications working under the 64-bit JVM if that is possible.  Seems like it should be possible since the LWJGL download includes linux 64-bit natives.

I'm sure the problem is something simple that I forgot to do.  Sorry if this question has been asked a thousand times already - I always have trouble finding relevant posts using SMF's search option..


kappa

just curious, which version of lwjgl are you using?

if not the latest, can you try that?

paulscode

Quote from: Matthias on March 09, 2010, 07:30:43can you try to run "ldd liblwjgl64.so" ?

That produces the following output:
Quotenot a dynamic executable
All the .so files have permissions -rwxrwxrwx, so they should be executable.  Not sure what the "dynamic" part means, though.

Quote from: javalwjgl on March 09, 2010, 09:19:57just curious, which version of lwjgl are you using?
I am using stable release 2.3 from the Download section, which I downloaded yesterday.

paulscode

Interestingly, running command:
readelf -d liblwjgl64.so

generates the following output:
QuoteDynamic section at offset 0x5dd00 contains 29 entries:
  Tag        Type                         Name/Value
0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
0x0000000000000001 (NEEDED)             Shared library: [libX11.so.6]
0x0000000000000001 (NEEDED)             Shared library: [libXext.so.6]
0x0000000000000001 (NEEDED)             Shared library: [libXcursor.so.1]
0x0000000000000001 (NEEDED)             Shared library: [libXrandr.so.2]
0x0000000000000001 (NEEDED)             Shared library: [libXxf86vm.so.1]
0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED)             Shared library: [libjawt.so]
0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
0x000000000000000c (INIT)               0x2c6f0
0x000000000000000d (FINI)               0x4ad78
0x0000000000000004 (HASH)               0x190
0x000000006ffffef5 (GNU_HASH)           0x2d78
0x0000000000000005 (STRTAB)             0x10608
0x0000000000000006 (SYMTAB)             0x5f88
0x000000000000000a (STRSZ)              95951 (bytes)
0x000000000000000b (SYMENT)             24 (bytes)
0x0000000000000003 (PLTGOT)             0x25dfe8
0x0000000000000002 (PLTRELSZ)           2736 (bytes)
0x0000000000000014 (PLTREL)             RELA
0x0000000000000017 (JMPREL)             0x2bc40
0x0000000000000007 (RELA)               0x28b38
0x0000000000000008 (RELASZ)             12552 (bytes)
0x0000000000000009 (RELAENT)            24 (bytes)
0x000000006ffffffe (VERNEED)            0x28ab8
0x000000006fffffff (VERNEEDNUM)         3
0x000000006ffffff0 (VERSYM)             0x27cd8
0x000000006ffffff9 (RELACOUNT)          519
0x0000000000000000 (NULL)               0x0

So if the file is executable and it has a "Dynamic section", why do you suppose ldd would say that it isn't a dynamic executable?

paulscode

Also, command:
file liblwjgl64.so

produces output:
Quoteliblwjgl64.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

kappa

odd error your having, I also run LWJGL on linux 64bit (openSUSE), works fine for me.


paulscode

AHA!  I figured it out.  The problem is that it is a shared library located in a shared writable directory.  Security Enhanced Linux does not allow it to execute, because otherwise web exploits could be written where an executable would write a shared library into /tmp and then load it, since the web server normally would have write access to /tmp.  I suppose it's a good thing that the Linux developers are smarter than I am..

Anyway, to fix the problem (in case someone else experiences this), I simply moved the native .so files to a different directory that isn't shared+writable.