jNavigation can't load jNavigationNative.so

@Tihomir
Hi, today I found the jNavigation-Project and it seemed very nice and so I wanted to give it a try.
I downloaded the Zip-from the Repository(GitHub - QuietOne/jNavigationPlugin) and as I wasn’t sure what I had to do, I just added the .jar /release/modules/ext as Library in jME. But as I run the example from the Documentation the following exception was thrown:
java.lang.UnsatisfiedLinkError: Can’t load library: /Path/to/my/Project/native_build/jNavigationNative.so
I think that it is not enough to add the .jar as a library, but I have no idea what i should.
It would be nice if someone could help me!

I don’t know how JME plugins works do I don’t know how to set it up, but if you want to try jNavigation, dowload it from GitHub - QuietOne/jNavigation: Navigation for jMonkey Engine. . It is same project, but before it was wrapped as plugin. It is functional. For this project you have to only add .jar. Did this help you?

First in this Repository is no .jar (or I didn’t found it.)
I tried it with the jar from GitHub - QuietOne/jNavigationPlugin and the jNavigationNative.so from your link.
Now i get the following exception: jNavigationNative.so: %1 ist keine zulässige Win32-Anwendung

Ok. I now understand the problem. I worked on Linux I’ve compiled native library as .so file. Because of it jNavigation for now is for Linux only. If you have C++ compiler, you can build native library GitHub - QuietOne/jNavigation-native: JNI made for jNavigation.

It very easy, and if you want, I can guide you how to make it, and then when everything works, you can send me .dll native file, so I can include it jNavigation.

I’m currently installing the cygwin c++ compiler. If I have the .dll finished i will send it to you.
But I think it won’t be enough to just substitute the .so with the .dll because the Libary searches for a .so or?

I tried to build the Project but it failed with the following error message:

compilation terminated.
nbproject/Makefile-Debug.mk:210: recipe for target ‘build/Debug/Cygwin_4.x-Windows/Recast_wrap.o’ failed
make[2]: *** [build/Debug/Cygwin_4.x-Windows/Recast_wrap.o] Error 1
make[2]: Leaving directory ‘…/jNavigation-native-master/jNavigation-native-master’
nbproject/Makefile-Debug.mk:83: recipe for target ‘.build-conf’ failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory ‘…/jNavigation-native-master/jNavigation-native-master’
nbproject/Makefile-impl.mk:39: recipe for target ‘.build-impl’ failed
make: *** [.build-impl] Error 2

Unfortunately i have no idea what this means :frowning:

@hololol2 said: I'm currently installing the cygwin c++ compiler. If I have the .dll finished i will send it to you. But I think it won't be enough to just substitute the .so with the .dll because the Libary searches for a .so or?

You will have to get GitHub - QuietOne/jNavigation: Navigation for jMonkey Engine. project and to change the code at the bottom of class https://github.com/QuietOne/jNavigation/blob/master/src/com/jme3/ai/navigation/utils/RecastJNI.java to get jNavigationNative.dll and to put in jNavigation in folder native_build.

Use that project and if that works, I will add code to jNavigation to check OS and to load .so or .dll, you have made.

I tried to build the Project but it failed with the following error message:

compilation terminated.
nbproject/Makefile-Debug.mk:210: recipe for target ‘build/Debug/Cygwin_4.x-Windows/Recast_wrap.o’ failed
make[2]: *** [build/Debug/Cygwin_4.x-Windows/Recast_wrap.o] Error 1
make[2]: Leaving directory ‘…/jNavigation-native-master/jNavigation-native-master’
nbproject/Makefile-Debug.mk:83: recipe for target ‘.build-conf’ failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory ‘…/jNavigation-native-master/jNavigation-native-master’
nbproject/Makefile-impl.mk:39: recipe for target ‘.build-impl’ failed
make: *** [.build-impl] Error 2

Unfortunately i have no idea what this means :frowning:

I am sorry, but I don’t know either.

Ok. I’m a bit further but now I got a new error:

[java]build/Release/Cygwin_4.x-Windows/Recast_wrap.o:Recast_wrap.cxx:(.text+0x3802): undefined reference to dtQueryFilter::passFilter(unsigned int, dtMeshTile const*, dtPoly const*) const' build/Release/Cygwin_4.x-Windows/Recast_wrap.o:Recast_wrap.cxx:(.text+0x3802): relocation truncated to fit: R_X86_64_PC32 against undefined symbol dtQueryFilter::passFilter(unsigned int, dtMeshTile const*, dtPoly const*) const’
build/Release/Cygwin_4.x-Windows/Recast_wrap.o:Recast_wrap.cxx:(.text+0x387f): undefined reference to dtQueryFilter::getCost(float const*, float const*, unsigned int, dtMeshTile const*, dtPoly const*, unsigned int, dtMeshTile const*, dtPoly const*, unsigned int, dtMeshTile const*, dtPoly const*) const' build/Release/Cygwin_4.x-Windows/Recast_wrap.o:Recast_wrap.cxx:(.text+0x387f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol dtQueryFilter::getCost(float const*, float const*, unsigned int, dtMeshTile const*, dtPoly const*, unsigned int, dtMeshTile const*, dtPoly const*, unsigned int, dtMeshTile const*, dtPoly const*) const’[/java]

I have no idea of the c/c++ but it seems to me that in this function call the compiler sees “arg2” as unsigned int, but it is initiated as dtPolyRef.
[java]passFilter(arg2,(dtMeshTile const *)arg3,(dtPoly const *)arg4);[/java]

That is ok. It is because jNavigation saves the memory location of its native parts as int, and in native code it cast it to right structure.

The only suggestion that I can give you is that I didn’t compile project in terminal, I used NetBeans 7.4, maybe this tutorial can help you setting up project: NetBeans Beginning JNI with NetBeans™ C/C++ Pack 5.5, Windows

I already solved it by myself. The problem was i used the Release Config and not the Debug Config. Now everything is alright and i get a .dll.
But when i tried to use it with jNavigation i get the error Message: jNavigationNative.dll: %1 ist keine zulässige Win32-Anwendung
I think the problem is that the .dll is 64-bit and 32-bit.
I’ll try to get 32-bit-dll

Im nearly finished but I want to test them short. But I have a Problem to which I’m not able to find a solution.
I’ve created a scene with a random terrain within the SDK. When i load the j3o in the Java code i get a Node and all children are TerrainQuad’s. But for the first line in the sample programm from the Documentation i need a Mesh. But I only found a Method to create a Mesh from a Geometry, not from a Node or TerrainQuad.

1 Like

Ok. I was now able to run a test with a mesh of a terrain. But unfortunately the example-code from Documentation crashes somewhere within step2.
There either is a error message like this:

A fatal error has been detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000000254f0e1, pid=7916, tid=6892

JRE version: Java™ SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13)

Java VM: Java HotSpot™ 64-Bit Server VM (24.51-b03 mixed mode windows-amd64 compressed oops)

Problematic frame:

j java.lang.Thread.sleep(J)V+0

Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

An error report file with more information is saved as:

#*****

If you would like to submit a bug report, please visit:

http://bugreport.sun.com/bugreport/crash.jsp

Java Result: 1

Or this Java Result: -1073741819

I don’t have experience with that structure, but it should contain mesh on some level, as far as I understood the problem. (In node tree, leafs are geometry)

I see now that junit test are needed, for further developing Recast.

I have two suggestions:

  1. You said that you compiled native library as 32 bits and you have 64 bits JVM. Maybe that caused the problem.
  2. Failed to write core dump. Minidumps are not enabled by default on client versions of Windows - I didn’t have bug reports durring GSoC, so the code is not tested well. I only tested on ubuntu, so I can’t help you with this isue.
  1. Yes I said that first. But I now have a 32-bit and a 64-ibt library.
  2. Ok. Maybe I will look into it.
    I’ll send you both librarys now even if they may not function right, so you can upload them on github. As I said you need a 32-bit and 64-bit library and load the right one.

With a bit Testing i found out that the Problem likely is located within the rcAllocHeightfield() Method of the RecastJNI or the same Method of the native library.
I’ll try to find the problem, but if anyone may has an idea feel free to post it here.

Hello Everyone

I wanted to know if either of you have successfully gotten jNavigation to work on Windows. I have gone through everything in this post and what i have seen online. I have compiled the jNavigation into a .dll and added the jar to my project. When i run my project i get the following error:

java.lang.UnsatisfiedLinkError: com.jme3.ai.navigation.utils.RecastJNI.new_rcConfig()J
	at com.jme3.ai.navigation.utils.RecastJNI.new_rcConfig(Native Method)
	at com.jme3.ai.navigation.recast.Config.<init>(Config.java:37)
	at mygame.NavMeshHelp.<init>(NavMeshHelp.java:34)
	at mygame.Enemy.<init>(Enemy.java:45)
	at mygame.Main.simpleInitApp(Main.java:88)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
	at java.lang.Thread.run(Thread.java:744)

Does anyone know or have any idea as to how to fix this error? I will still be plugging away at it in the mean time.

Thanks

@Tihomir said: 1. You said that you compiled native library as 32 bits and you have 64 bits JVM. Maybe that caused the problem.

opposite :slight_smile: 64 bit file can not run on 32 bit machine

Unfortunately I wasn’t able to get jNavigation to work :frowning: