Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY)

CentOS 6.3 64bit



[duzc2@localhost JCuda-All-0.4.2-src]$ cmake .

– The C compiler identification is GNU

– The CXX compiler identification is GNU

– Check for working C compiler: /usr/bin/gcc

– Check for working C compiler: /usr/bin/gcc – works

– Detecting C compiler ABI info

– Detecting C compiler ABI info - done

– Check for working CXX compiler: /usr/bin/c++

– Check for working CXX compiler: /usr/bin/c++ – works

– Detecting CXX compiler ABI info

– Detecting CXX compiler ABI info - done

– Found CUDA: /usr/local/cuda (Required is at least version “4.0”)

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):

Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY)

Call Stack (most recent call first):

/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)

/usr/share/cmake/Modules/FindJNI.cmake:236 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)

CMakeLists.txt:10 (find_package)





– Configuring incomplete, errors occurred!





but I have exported the values



[duzc2@localhost JCuda-All-0.4.2-src]$ echo $JAVA_AWT_LIBRARY

/usr/lib/jvm/java/jre/lib/amd64

[duzc2@localhost JCuda-All-0.4.2-src]$ echo $JAVA_JVM_LIBRARY

/usr/lib/jvm/java

[duzc2@localhost JCuda-All-0.4.2-src]$





did I make any mistake ?

thank you for help


Hello

I can’t directly see what’s wrong there. I did a websearch for >>>“Could NOT find JNI” cmake FindPackageHandleStandardArgs<<< and this (and similar searches) brings hundreds of results, but only some strange bug reports and build logs without any explaination or solution…

Which version of CMake are you using? (I’m using 2.8). Not sure whether it is related to CMake, but it is most likely somehow related to the “share\cmake-2.8\Modules\FindJNI.cmake” module…

What happens when you start it via “cmake-gui” ?

bye
Marco

[QUOTE=Marco13]Hello

I can’t directly see what’s wrong there. I did a websearch for >>>“Could NOT find JNI” cmake FindPackageHandleStandardArgs<<< and this (and similar searches) brings hundreds of results, but only some strange bug reports and build logs without any explaination or solution…

Which version of CMake are you using? (I’m using 2.8). Not sure whether it is related to CMake, but it is most likely somehow related to the “share\cmake-2.8\Modules\FindJNI.cmake” module…

What happens when you start it via “cmake-gui” ?

bye
Marco[/QUOTE]

cmake version 2.8.4

cmake-gui tells me :
CUDA_SDK_ROOT_DIR-NOTFOUND
JAVA_AWT_LIBRARY-NOTFOUND
JAVA_JVM_LIBRARY-NOTFOUND

but , I have set those all .

did I make any mistake ?
[duzc2@localhost JCuda-All-0.4.2-src]$ echo $CUDA_SDK_ROOT_DIR
/home/duzc2/NVIDIA_GPU_Computing_SDK/C
[duzc2@localhost JCuda-All-0.4.2-src]$ echo $JAVA_AWT_LIBRARY
/usr/lib/jvm/java/jre/lib/amd64
[duzc2@localhost JCuda-All-0.4.2-src]$ echo $JAVA_JVM_LIBRARY
/usr/lib/jvm/java/lib

Actually, the “FindCUDA” and “FindJNI” scripts should be capable of resolving these, assuming that the CUDA Toolkit and the JDK are properly installed. I’m not so sure about the environment variable settings in Linux, but… When cmake-gui says “…NOTFOUND”, can you click on the respective element and enter the respective path manually…? (It should not be necessary, but could possibly get it working…)

thank you for help.
I have set the PATHs manually in gui , and I press the Configure button , it told me that:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_CUDPP_HASH_LIBRARY (ADVANCED)
linked by target „JCudpp-linux-x86_64“ in directory /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/JCudppJNI
CUDA_CUDPP_INCLUDE_DIR (ADVANCED)
used as include directory in directory /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/JCudppJNI
CUDA_CUDPP_LIBRARY (ADVANCED)
linked by target „JCudpp-linux-x86_64“ in directory /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/JCudppJNI

Configuring incomplete, errors occurred!

[QUOTE=duzc2]thank you for help.
I have set the PATHs manually in gui , and I press the Configure button , it told me that:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_CUDPP_HASH_LIBRARY (ADVANCED)
linked by target “JCudpp-linux-x86_64” in directory /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/JCudppJNI
CUDA_CUDPP_INCLUDE_DIR (ADVANCED)
used as include directory in directory /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/JCudppJNI
CUDA_CUDPP_LIBRARY (ADVANCED)
linked by target “JCudpp-linux-x86_64” in directory /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/JCudppJNI

Configuring incomplete, errors occurred![/QUOTE]

I set the 3 PATH also , and this time :
Configuring done
Generating done

but it was very fast in one second , I did not find any result in the src folder.

It should have created the makefiles in the path that you specified as “Where to build the binaries”. Does this path contain anything?

Oh, by the way: The last error messages are only related to JCudpp/CUDPP. You’d have to compile this on your own (also with CMake ;)) but if you don’t specifically need JCudpp, you can simply omit it, by removing the last line,
add_subdirectory(JCudppJNI)
from the main CMake file.

Oh, yes , how stupid I am .
and I got the CUDPP error , thank you for hint . I’ll try again.
Thank you very much.

OK, let me know whether the compilation now works.

I’ll have to check the cmake files with the newest CMake version, to see why it does not find the JNI libs automatically…

[QUOTE=Marco13]OK, let me know whether the compilation now works.

I’ll have to check the cmake files with the newest CMake version, to see why it does not find the JNI libs automatically…[/QUOTE]

I guess the problem is the library should be the files :
export JAVA_AWT_LIBRARY=/usr/lib/jvm/java/jre/lib/amd64/libawt.so
export JAVA_JVM_LIBRARY=/usr/lib/jvm/java/jre/lib/amd64/server/libjvm.so

I did set them to the folder.

Oh ,yeah , I think I got it , but I still can’t find out the target file .
I’m sorry I’m a pure java programmer .

[duzc2@localhost JCuda-All-0.4.2-dist]$ make
Scanning dependencies of target CommonJNI
[ 9%] Building CXX object CommonJNI/CMakeFiles/CommonJNI.dir/src/JNIUtils.cpp.o
[ 18%] Building CXX object CommonJNI/CMakeFiles/CommonJNI.dir/src/Logger.cpp.o
[ 27%] Building CXX object CommonJNI/CMakeFiles/CommonJNI.dir/src/PointerUtils.cpp.o
/home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/CommonJNI/src/PointerUtils.cpp: In function ‘PointerData* initPointerData(JNIEnv*, _jobject*)’:
/home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/CommonJNI/src/PointerUtils.cpp:173: ??? NULL
/home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/CommonJNI/src/PointerUtils.cpp: In function ‘bool isPointerBackedByNativeMemory(JNIEnv*, _jobject*)’:
/home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/CommonJNI/src/PointerUtils.cpp:299: ??? NULL
Linking CXX static library /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/lib/libCommonJNI.a
[ 27%] Built target CommonJNI
Scanning dependencies of target JCudaDriver-linux-x86_64
[ 36%] Building CXX object JCudaDriverJNI/CMakeFiles/JCudaDriver-linux-x86_64.dir/src/JCudaDriver.cpp.o
Linking CXX shared library /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/lib/libJCudaDriver-linux-x86_64.so
[ 36%] Built target JCudaDriver-linux-x86_64
Scanning dependencies of target JCudaRuntime-linux-x86_64
[ 45%] Building CXX object JCudaRuntimeJNI/CMakeFiles/JCudaRuntime-linux-x86_64.dir/src/JCudaRuntime.cpp.o
Linking CXX shared library /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/lib/libJCudaRuntime-linux-x86_64.so
[ 45%] Built target JCudaRuntime-linux-x86_64
Scanning dependencies of target JCublas-linux-x86_64
[ 54%] Building CXX object JCublasJNI/CMakeFiles/JCublas-linux-x86_64.dir/src/JCublas.cpp.o
Linking CXX shared library /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/lib/libJCublas-linux-x86_64.so
[ 54%] Built target JCublas-linux-x86_64
Scanning dependencies of target JCublas2-linux-x86_64
[ 63%] Building CXX object JCublas2JNI/CMakeFiles/JCublas2-linux-x86_64.dir/src/JCublas2.cpp.o
Linking CXX shared library /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/lib/libJCublas2-linux-x86_64.so
[ 63%] Built target JCublas2-linux-x86_64
Scanning dependencies of target JCufft-linux-x86_64
[ 72%] Building CXX object JCufftJNI/CMakeFiles/JCufft-linux-x86_64.dir/src/JCufft.cpp.o
Linking CXX shared library /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/lib/libJCufft-linux-x86_64.so
[ 72%] Built target JCufft-linux-x86_64
Scanning dependencies of target JCurand-linux-x86_64
[ 81%] Building CXX object JCurandJNI/CMakeFiles/JCurand-linux-x86_64.dir/src/JCurand.cpp.o
Linking CXX shared library /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/lib/libJCurand-linux-x86_64.so
[ 81%] Built target JCurand-linux-x86_64
Scanning dependencies of target JCusparse-linux-x86_64
[ 90%] Building CXX object JCusparseJNI/CMakeFiles/JCusparse-linux-x86_64.dir/src/JCusparse.cpp.o
Linking CXX shared library /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/lib/libJCusparse-linux-x86_64.so
[ 90%] Built target JCusparse-linux-x86_64
Scanning dependencies of target JCusparse2-linux-x86_64
[100%] Building CXX object JCusparse2JNI/CMakeFiles/JCusparse2-linux-x86_64.dir/src/JCusparse2.cpp.o
Linking CXX shared library /home/duzc2/.download/jcuda/JCuda-All-0.4.2-src/lib/libJCusparse2-linux-x86_64.so
[100%] Built target JCusparse2-linux-x86_64
[duzc2@localhost JCuda-All-0.4.2-dist]$

[QUOTE=Marco13]OK, let me know whether the compilation now works.

I’ll have to check the cmake files with the newest CMake version, to see why it does not find the JNI libs automatically…[/QUOTE]

oh. I found it . they are in src/lib …
thank you for help .
but what is the libCommonJNI.a file for ?

Good to hear that you made it.

The libCommonJNI.a is not required in the end. It is just a common library that is used when building the others, but once they are built, the libCommonJNI.a may be deleted.