I am trying to use OpenAL under 32-bit Linux but there's an exception loading libopenal32.so. Using the same PC but 64-bit Linux works. I am encountering this problem on all three devices I've tested this on. I've tried both OpenJDK and HotSpot (Java 8).
I'm not sure if the warning regarding the stack guard is relevant.
OpenGL is working.
[LWJGL] Version 3.0.0a | Linux | i386
OpenJDK Server VM warning: You have loaded library /mnt/usb/Development/bms/lwjgl3/native/liblwjgl32.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
[LWJGL] MemoryUtil MemoryAccessor: MemoryAccessorUnsafe
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.lwjgl.openal.ALDevice.create(ALDevice.java:71)
at org.lwjgl.openal.ALContext.create(ALContext.java:90)
at bms.sound.OpenAlSoundEngine.initialize(OpenAlSoundEngine.java:29)
at experiment.HelloLwjgl.loop(HelloLwjgl.java:116)
at experiment.HelloLwjgl.run(HelloLwjgl.java:50)
at bms.Bms.main(Bms.java:7)
Caused by: java.lang.RuntimeException: Failed to dynamically load library: lwjgl3/native/libopenal32.so
at org.lwjgl.system.linux.LinuxLibrary.<init>(LinuxLibrary.java:29)
at org.lwjgl.system.APIUtil.apiCreateLibrary(APIUtil.java:56)
at org.lwjgl.LWJGLUtil$2.load(LWJGLUtil.java:402)
at org.lwjgl.LWJGLUtil$2.load(LWJGLUtil.java:399)
at org.lwjgl.LWJGLUtil.loadLibrary(LWJGLUtil.java:410)
at org.lwjgl.LWJGLUtil.loadLibraryNative(LWJGLUtil.java:370)
at org.lwjgl.openal.ALC.create(ALC.java:55)
at org.lwjgl.openal.ALC.create(ALC.java:48)
at org.lwjgl.openal.ALC.<clinit>(ALC.java:27)
... 6 more
Thanks, the next nightly build (#53) will have the correct OpenAL library.
The stack guard warning is caused by libffi (which is statically linked into liblwjgl3). I believe it's harmless. You can ignore it and I will try to get rid of it soon.
It's working now. Thank you!
I'm having the same issue but on mac, there is an error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at audio.AudioMaster.init(AudioMaster.java:22)
at test.Main.main(Main.java:9)
Caused by: java.lang.RuntimeException: Failed to dynamically load library: /[there was path to my project]/lwjgl3/native/libopenal.dylib
at org.lwjgl.system.macosx.MacOSXLibraryDL.
at org.lwjgl.system.macosx.MacOSXLibrary.create(MacOSXLibrary.java:20)
at org.lwjgl.system.APIUtil.apiCreateLibrary(APIUtil.java:80)
at org.lwjgl.system.Library$2.load(Library.java:33)
at org.lwjgl.system.Library$2.load(Library.java:30)
at org.lwjgl.system.Library.loadLibrary(Library.java:196)
at org.lwjgl.system.Library.loadNative(Library.java:135)
at org.lwjgl.openal.ALC.create(ALC.java:49)
at org.lwjgl.openal.ALC.create(ALC.java:45)
at org.lwjgl.openal.ALC.
... 2 more
I cannot reproduce it. Could you run with -Dorg.lwjgl.util.Debug=true and post the output here? Also, please make sure you use the latest nightly build.
With the latest nightly version:
[LWJGL] Version: 3.0.0 build 78
[LWJGL] OS: Mac OS X v10.11.4
[LWJGL] JRE: 1.8.0_74 x86_64
[LWJGL] JVM: Java HotSpot(TM) 64-Bit Server VM v25.74-b02 by Oracle Corporation
[LWJGL] Loaded library from java.library.path: lwjgl
[LWJGL] ThreadLocalUtil state: UnsafeState
[LWJGL] MemoryUtil accessor: MemoryAccessorUnsafe
[LWJGL] Failed to extract glfw library
java.lang.RuntimeException: Failed to dynamically load library: /[path to my project]//lwjgl/native/libglfw.dylib(error = dlopen(/[path to my project]/lwjgl/native/libglfw.dylib, 9): image not found)
at org.lwjgl.system.macosx.MacOSXLibraryDL.
at org.lwjgl.system.macosx.MacOSXLibrary.create(MacOSXLibrary.java:20)
at org.lwjgl.system.APIUtil.apiCreateLibrary(APIUtil.java:84)
at org.lwjgl.system.Library.lambda$static$1(Library.java:32)
at org.lwjgl.system.Library.loadLibrary(Library.java:230)
at org.lwjgl.system.Library.loadNativeRelative(Library.java:167)
at org.lwjgl.system.Library.loadNative(Library.java:146)
at org.lwjgl.glfw.GLFW.
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:142)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1088)
at java.lang.reflect.Field.getFieldAccessor(Field.java:1069)
at java.lang.reflect.Field.getInt(Field.java:574)
at org.lwjgl.system.APIUtil.apiClassTokens(APIUtil.java:258)
at org.lwjgl.glfw.GLFWErrorCallback$1.
at org.lwjgl.glfw.GLFWErrorCallback.createPrint(GLFWErrorCallback.java:78)
at audio.AudioMaster.init(AudioMaster.java:28)
at test.Main.main(Main.java:9)
Exception in thread "main" java.lang.ExceptionInInitializerError
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:142)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1088)
at java.lang.reflect.Field.getFieldAccessor(Field.java:1069)
at java.lang.reflect.Field.getInt(Field.java:574)
at org.lwjgl.system.APIUtil.apiClassTokens(APIUtil.java:258)
at org.lwjgl.glfw.GLFWErrorCallback$1.
at org.lwjgl.glfw.GLFWErrorCallback.createPrint(GLFWErrorCallback.java:78)
at audio.AudioMaster.init(AudioMaster.java:28)
at test.Main.main(Main.java:9)
Caused by: java.lang.RuntimeException: Failed to dynamically load library: /[path to my project]/lwjgl/native/libglfw.dylib(error = null)
at org.lwjgl.system.macosx.MacOSXLibraryDL.
at org.lwjgl.system.macosx.MacOSXLibrary.create(MacOSXLibrary.java:20)
at org.lwjgl.system.APIUtil.apiCreateLibrary(APIUtil.java:84)
at org.lwjgl.system.Library.lambda$static$1(Library.java:32)
at org.lwjgl.system.Library.loadLibrary(Library.java:230)
at org.lwjgl.system.Library.loadNativeRelative(Library.java:167)
at org.lwjgl.system.Library.loadNative(Library.java:140)
at org.lwjgl.glfw.GLFW.
... 11 more
ps. Thank you very much for quick answer.
Looks like there's a problem with the library path(s), dlopen cannot even find the shared libraries. How is your application launched?
With eclipse and code(in run configurations):
-XstartOnFirstThread
It is breaking when call ALC.create();, or when I try to set GLFWErrorCallback
ps. I'm using JavaSE-1.8
Are you setting -Djava.library.path to the correct directory?
No I'm not...
So how should I set this?
I'm only add jar(lwjgl.jar) to the java build path and set native folder to native(from lwjgl folder).
Yes, -Djava.library.path should be set to the native folder.
Alternatively, you could add the natives to a jar and add that jar to the classpath; LWJGL will auto-extract it to a temp folder and use the natives automatically. (no -Djava.library.path is required in this case)
I must read something about it, because I really don't know how to do it...
I'm sorry for wasting your time. I have to learn more about it. I'm just a beginner but can you recommend me some tutorial?
Just like you added -XstartOnFirstThread to the "VM arguments" field in your run configuration, you also can add -Djava.library.path=/the/path/to/your/natives in that edit field. Either separate it from the other argument via a space or via newline.
I did it as you say but I still receive error(I'm sure that path is right).
Ok now it starts getting weird. I copied version of LWJGL from older project(which work pretty good), but I still have the same error(even if copy whole code)!
This could be related to SIP. Where did you extract the LWJGL binaries?
There was no need to extract the files(no .zip formats).
I think the point of Spasi's question was not to know whether you _extracted_ the files, but where they reside now. In some SIP-secured folder or something.
I finally managed to fix it. I have to reinstall eclipse and recreate all projects. It seems that with old eclipse(before reinstall) all projects was creating with some kind of bug/malfunction(or something like that), and with the new version it seems to work.
ps. Thank you all guys for suggestions and quick answers. You helped me a lot.