Issues with JNI on Mono (IKVM Trunk)
Tommy Ettinger <[email protected]>
| Newsgroups | gmane.comp.java.ikvm.devel |
|---|---|
| Message-ID | <CAAWSfZNYjnEF0Y8pi2fm057Jgv32fH3-Cjv_w2-0DD0ayBhTYw@mail.gmail.com> |
I've been struggling for the last two days to port my C# IKVM application that uses the Java library libgdx to Linux. The application works just fine on Windows/.NET, but something is wrong with the linking for JNI code AFAICT. Using libgdx you have a choice of backends for how to display graphics, one of which is LWJGL and one of which is JGLFW. LWJGL failed on both 32- and 64-bit Linux (after I figured out how to get it to load its dependencies from the right folder) with an UnsatisfiedLinkError in org.lwjgl.DefaultSysImplementation.getPointerSize()I , which (in the LWJGL source) is a native method with no body in the .java file. JGLFW failed on 64-bit Linux (haven't built it on 32-bit) with a different error, still in a native method: java.lang.UnsatisfiedLinkError: com/badlogic/jglfw/Glfw.glfwInitJni()Z at cli.IKVM.Runtime.JNI$Frame.GetFuncPtr(Unknown Source) I have had issues setting LD_LIBRARY_PATH on this machine (a VM running Fedora 20, 64-bit; the VM is run by VirtualBox on Windows 7 64-bit), and I believe java.library.path is unset, but the libraries are all in the current folder (same as the exe). My application is open source and the latest code is at https://github.com/tommyettinger/CommandersUnite/ and the only IKVM-specific code is in https://github.com/tommyettinger/CommandersUnite/blob/master/CU/CU/GameGDX.cs#L478 . I built gdx-jglfw.dll using the command: "%IKVM_HOME%/ikvmc.exe" -target:library -out:gdx-jglfw.dll -sharedclassloader gdx.jar gdx-natives.jar gdx-backend-jglfw.jar gdx-backend-jglfw-natives.jar where %IKVM_HOME% evaluated to the bin directory of the current trunk/head/master (latest) of the IKVM CVS on SourceForge (it actually may have been the latest nightly from the IKVM weblog, it is a version 8 or higher nightly). That command was run on the libgdx 1.2.0 binary release. I then extracted the dll and so files from the natives jars, copied them into the project, and set them to copy into the release directory. So my question is, is there a bug in my code, or in IKVM, here that can be fixed? Does JNI work at all under Mono/Linux? -- Thomas (Tommy) Ettinger ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Ikvm-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ikvm-developers