Re: Issues with JNI on Mono (IKVM Trunk)
Tommy Ettinger <[email protected]>
| Newsgroups | gmane.comp.java.ikvm.devel |
|---|---|
| Message-ID | <CAAWSfZP0TedEZkTBBfJQkuZp+9WJD2cf=FPfoJ2e5gFP=TZ67g@mail.gmail.com> |
This was harder to track down, but the line in Sys.java that defines a native method, getPointerSize() is implemented here https://github.com/LWJGL/lwjgl/blob/bafa7a1972718abf0f2304124a46ae3fa67be7df/src/native/common/common_tools.c#L64 . I'm not sure what is wrong with that code if it works on windows, odd. On Fri, Jul 18, 2014 at 5:37 PM, Tommy Ettinger <[email protected]> wrote: > I solved the trace issue, but the program still can't get past a part > where a Java library loads native code at runtime, and I have the output > here http://pastebin.com/q9xCBzsV . It has the JNI traces in that. The > issue seems to be related to dynamically loading libraries in JNI code; the > exact line it fails on is > https://github.com/LWJGL/lwjgl/blob/master/src/java/org/lwjgl/Sys.java#L113 > . It is entirely possible that LibGDX distributes a modified version of > LWJGL; I've tried swapping the jars and it has slightly different behavior > if the DLLs and JARs are not from the same project (it acts fine if they > come both from LWJGL 2.9.1 or both from a LibGDX nightly build, but still > has the same error on linux either way). Right now my code uses this > App.config ( > https://github.com/tommyettinger/CommandersUnite/blob/master/CU/CU/App.config ) > and it refers to these libraries from IKVM: ( > https://github.com/tommyettinger/CommandersUnite/blob/master/CU/CU/CU.csproj#L99-L153 ). > LibGDX was compiled to a DLL, gdx-cli.dll , using this command: > "%IKVM_HOME%/ikvmc.exe" -target:library -out:gdx-cli.dll > -sharedclassloader gdx.jar gdx-natives.jar gdx-backend-lwjgl.jar > gdx-backend-lwjgl-natives.jar > Do you have an idea of what could cause the problem I'm having? > > > > On Thu, Jul 17, 2014 at 1:06 AM, Jeroen Frijters <[email protected]> > wrote: > >> You should really ask on the Mono list about this. I don't know enough >> about Mono on Linux, but this looks seriously broken. >> >> > -----Original Message----- >> > From: Tommy Ettinger [mailto:[email protected]] >> > Sent: Wednesday, July 16, 2014 22:56 >> > To: Jeroen Frijters >> > Cc: [email protected] >> > Subject: Re: [Ikvm-developers] Issues with JNI on Mono (IKVM Trunk) >> > >> > Ah, figured out how to load the config on Mono. I think. Unfortunately >> > it gives a very different error: http://pastebin.com/GAsQyfA5 The >> > App.config is here >> > >> https://github.com/tommyettinger/CommandersUnite/blob/master/CU/CU/App.c >> > onfig >> > >> > >> > On Wed, Jul 16, 2014 at 1:30 PM, Tommy Ettinger >> > <[email protected] <mailto:[email protected]> > wrote: >> > >> > >> > My last message was too long for the list, so here it is with >> > pastebin links. >> > With those lines added to App.config, It gives the following >> output >> > on Windows 7 in Visual Studio's output window (and nothing new on Mono): >> > Visual Studio output: http://pastebin.com/6Jpi5FxV >> > Mono output: http://pastebin.com/BEMyAerk >> > >> > Thanks for your speedy reply on this, IKVM worked brilliantly >> until >> > I tried to get it to run on Mono. IKVM is a pretty incredible piece of >> > software. >> > >> > >> > On Wed, Jul 16, 2014 at 6:01 AM, Jeroen Frijters < >> [email protected] >> > <mailto:[email protected]> > wrote: >> > >> > >> > Hi Tommy, >> > >> > >> > >> > Can you try enabling JNI tracing by adding the following >> to >> > your app.config: >> > >> > >> > >> > <system.diagnostics> >> > >> > <switches> >> > >> > <add name="jni" value="4" /> >> > >> > </switches> >> > >> > </system.diagnostics> >> > >> > >> > >> > Regards, >> > >> > Jeroen >> > >> > >> > >> > From: Tommy Ettinger [mailto:[email protected] >> > <mailto:[email protected]> ] >> > Sent: Wednesday, July 16, 2014 14:00 >> > To: [email protected] <mailto:ikvm- >> > [email protected]> >> > Subject: [Ikvm-developers] Issues with JNI on Mono (IKVM >> > Trunk) >> > >> > >> > >> > 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/GameG >> > DX.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 >> > >> > >> > >> > >> > >> > -- >> > >> > Thomas (Tommy) Ettinger >> > >> > >> > >> > >> > -- >> > >> > Thomas (Tommy) Ettinger >> > > > > -- > > Thomas (Tommy) Ettinger > -- 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