GlueGen tries to load 64 bits libs on 64 bits machines using 32 bits JVM

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GlueGen tries to load 64 bits libs on 64 bits machines using 32 bits JVM

gouessej
Administrator
Hi

When jogamp.gluegen.UseTempJarCache is set to true (by default), GlueGen tries to extract native libraries from JARs. It uses the architecture of the machine to determine which one should be loaded.

However, when someone uses a 32 bits JVM on a 64 bits machine, GlueGen does not find the 32 bits libraries as Java Web Start retrieves only the 64 bits libraries. How can I solve this problem? Should Java Web Start use a single JAR containing all native libraries? Should GlueGen then load the native libraries by looking at the architecture of the JVM?

Someone tested my game and obtained this:
Detected from bootclasspath: C:\\Program Files (x86)\\Java\\jre7\\lib\deploy.jar
Dez 24, 2011 10:56:23 AM engine.integration.DesktopIntegration <init>
Information: operating system: windows 7
Dez 24, 2011 10:56:23 AM engine.integration.DesktopIntegration <init>
Information: operating system family: Windows
Dez 24, 2011 10:56:23 AM engine.integration.DesktopIntegration <init>
Information: tries to create a temporary file to contain the WSH script...
Dez 24, 2011 10:56:23 AM engine.integration.DesktopIntegration <init>
Information: temporary file C:\Users\EGONOL~1\AppData\Local\Temp\getDesktopFolder5195775719385520981.js successfully created
Dez 24, 2011 10:56:23 AM engine.integration.DesktopIntegration <init>
Information: temporary file C:\Users\EGONOL~1\AppData\Local\Temp\getDesktopFolder5195775719385520981.js successfully filled
Dez 24, 2011 10:56:23 AM engine.integration.DesktopIntegration <init>
Information: registry value used as a desktop path: C:\Users\EgonOlsen\Desktop
Dez 24, 2011 10:56:23 AM engine.integration.DesktopIntegration <init>
Information: operating system supported. Desktop path: C:\Users\EgonOlsen\Desktop

Starting up SoundSystem...
Initializing JOAL
    (The JOAL binding of OpenAL.  For more information, see http://joal.dev.java.net/)
java.nio.channels.ClosedByInterruptException
   at java.nio.channels.spi.AbstractInterruptibleChannel.end(Unknown Source)
   at sun.nio.ch.FileChannelImpl.write(Unknown Source)
   at java.nio.channels.Channels.writeFullyImpl(Unknown Source)
   at java.nio.channels.Channels.writeFully(Unknown Source)
   at java.nio.channels.Channels.access$000(Unknown Source)
   at java.nio.channels.Channels$1.write(Unknown Source)
   at java.nio.file.Files.copy(Unknown Source)
   at java.nio.file.Files.copy(Unknown Source)
   at sun.net.www.protocol.jar.URLJarFile$1.run(Unknown Source)
   at sun.net.www.protocol.jar.URLJarFile$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
   at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
   at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
   at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
   at com.sun.jnlp.JNLPCachedJarURLConnection.connect(Unknown Source)
   at com.sun.jnlp.JNLPCachedJarURLConnection.getJarFile(Unknown Source)
   at com.jogamp.common.util.JarUtil.getJarFile(JarUtil.java:294)
   at com.jogamp.common.util.cache.TempJarCache.bootstrapNativeLib(TempJarCache.java:346)
   at com.jogamp.common.os.Platform$3.run(Platform.java:312)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.jogamp.common.os.Platform.loadGlueGenRTImpl(Platform.java:303)
   at com.jogamp.common.os.Platform.<clinit>(Platform.java:214)
   at com.jogamp.common.os.NativeLibrary.<clinit>(NativeLibrary.java:76)
   at com.jogamp.common.os.DynamicLibraryBundle.<clinit>(DynamicLibraryBundle.java:56)
   at jogamp.openal.ALImpl$1.run(ALImpl.java:2250)
   at java.security.AccessController.doPrivileged(Native Method)
   at jogamp.openal.ALImpl.<clinit>(ALImpl.java:2247)
   at com.jogamp.openal.ALFactory.initialize(ALFactory.java:58)
   at com.jogamp.openal.ALFactory.getALC(ALFactory.java:92)
   at com.jogamp.openal.util.ALut.alutInit(ALut.java:66)
   at paulscode.sound.libraries.LibraryJOAL.init(LibraryJOAL.java:154)
   at paulscode.sound.SoundSystem.CommandNewLibrary(SoundSystem.java:1576)
   at paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2572)
   at paulscode.sound.CommandThread.run(CommandThread.java:121)
Exception in thread "Thread-12" java.lang.ExceptionInInitializerError
   at com.jogamp.common.os.NativeLibrary.<clinit>(NativeLibrary.java:76)
   at com.jogamp.common.os.DynamicLibraryBundle.<clinit>(DynamicLibraryBundle.java:56)
   at jogamp.openal.ALImpl$1.run(ALImpl.java:2250)
   at java.security.AccessController.doPrivileged(Native Method)
   at jogamp.openal.ALImpl.<clinit>(ALImpl.java:2247)
   at com.jogamp.openal.ALFactory.initialize(ALFactory.java:58)
   at com.jogamp.openal.ALFactory.getALC(ALFactory.java:92)
   at com.jogamp.openal.util.ALut.alutInit(ALut.java:66)
   at paulscode.sound.libraries.LibraryJOAL.init(LibraryJOAL.java:154)
   at paulscode.sound.SoundSystem.CommandNewLibrary(SoundSystem.java:1576)
   at paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2572)
   at paulscode.sound.CommandThread.run(CommandThread.java:121)
Caused by: java.lang.NullPointerException
   at com.jogamp.common.os.NativeLibrary.isValidNativeLibraryName(NativeLibrary.java:259)
   at com.jogamp.common.util.cache.TempJarCache.findLibrary(TempJarCache.java:288)
   at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:303)
   at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:55)
   at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:85)
   at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:215)
   at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:365)
   at com.jogamp.common.os.Platform$3.run(Platform.java:317)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.jogamp.common.os.Platform.loadGlueGenRTImpl(Platform.java:303)
   at com.jogamp.common.os.Platform.<clinit>(Platform.java:214)
   ... 12 more
The initialization of the sound manager (based on JOAL) failed: paulscode.sound.SoundSystemException: SoundSystem did not load after 30 seconds.

Starting up SoundSystem...
Initializing Java Sound
    (The Java Sound API.  For more information, see http://java.sun.com/products/java-media/sound/)
JavaSound initialized.

java.lang.NoClassDefFoundError: Could not initialize class com.jogamp.common.os.Platform
   at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:81)
   at com.ardor3d.framework.jogl.JoglNewtWindow.<clinit>(JoglNewtWindow.java:37)
   at engine.service.Ardor3DGameServiceProvider.<init>(Ardor3DGameServiceProvider.java:212)
   at engine.service.Ardor3DGameServiceProvider.main(Ardor3DGameServiceProvider.java:159)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.sun.javaws.Launcher.executeApplication(Unknown Source)
   at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
   at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
   at com.sun.javaws.Launcher.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
#### Java Web Start Error:
#### null

Edit.: the bitness of the JVM can be detected by using the property sun.arch.data.model.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GlueGen tries to load 64 bits libs on 64 bits machines using 32 bits JVM

Gene
I ran into this back in JOGL 1 days building an installer to pick 32- or 64-bit DLLs.  After much research I wrote the following code which has worked well on thousands of machines to date.  The project is welcome to the code and algorithm.

public class DetectJVM {

    // Add to this list any Java attribute that, if the key exists in global
    // properties, the value contains a 64 if and only if we are running a
    // 64-bit JVM, which therefore needs AMD64 format DLLs in Windows.
    private static final String keys [] = {
        "sun.arch.data.model",
        "com.ibm.vm.bitmode",
        "os.arch",
    };

    public static void main (String [] args) {
        boolean print = args.length > 0 && "-print".equals(args[0]);
        for (String key : keys) {
            String property = System.getProperty(key);
            if (print) {
                System.out.println(key + "=" + property);
            }
            if (property != null) {
                int errCode = (property.indexOf("64") >= 0) ? 64 : 32;
                if (print) {
                    System.out.println("err code=" + errCode);
                }
                System.exit(errCode);
            }
        }
    }
}