Hi! I get some errors then tried compile JCuda 0.4.0RC2 compile failed on Gentoo 64bit with gcc-4.5.2 and gcc-4.4.5.
This error is “error: cast from ‘void*’ to ‘CUdevice’ loses precision”.
I found that errors reason is such code in JCudaDriverJNI/src/JCudaDriver.cpp:
CUdevice nativeDev = (CUdevice)getNativePointerValue(env, dev);
If change the code line above on:
CUdevice nativeDev = (CUdevice)(size_t)getNativePointerValue(env, dev);
tnen compilation is succes whith warnings.
JCuda-All-0.4.0RC2-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘jint Java_jcuda_driver_JCudaDriver_cuModuleGetGlobalNative(JNIEnv*, _jclass*, _jobject*, _jlongArray*, _jobject*, _jstring*)’:
JCuda-All-0.4.0RC2-src/JCudaDriverJNI/src/JCudaDriver.cpp:1369:30: warning: converting to non-pointer type ‘CUdeviceptr’ from NULL
JCuda-All-0.4.0RC2-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘jint Java_jcuda_driver_JCudaDriver_cuGraphicsResourceGetMappedPointerNative(JNIEnv*, _jclass*, _jobject*, _jlongArray*, _jobject*)’:
JCuda-All-0.4.0RC2-src/JCudaDriverJNI/src/JCudaDriver.cpp:4938:33: warning: converting to non-pointer type ‘CUdeviceptr’ from NULL
Linking CXX shared library ../../lib/libJCudaDriver-linux-x86_64.so
[ 44%] Built target JCudaDriver-linux-x86_64
[ 55%] Building CXX object JCudaRuntimeJNI/CMakeFiles/JCudaRuntime-linux-x86_64.dir/src/JCudaRuntime.cpp.o
Linking CXX shared library ../../lib/libJCudaRuntime-linux-x86_64.so
[ 55%] Built target JCudaRuntime-linux-x86_64
[ 66%] Building CXX object JCublasJNI/CMakeFiles/JCublas-linux-x86_64.dir/src/JCublas.cpp.o
Linking CXX shared library ../../lib/libJCublas-linux-x86_64.so
[ 66%] Built target JCublas-linux-x86_64
[ 77%] Building CXX object JCufftJNI/CMakeFiles/JCufft-linux-x86_64.dir/src/JCufft.cpp.o
Linking CXX shared library ../../lib/libJCufft-linux-x86_64.so
[ 77%] Built target JCufft-linux-x86_64
[ 88%] Building CXX object JCurandJNI/CMakeFiles/JCurand-linux-x86_64.dir/src/JCurand.cpp.o
JCuda-All-0.4.0RC2-src/JCurandJNI/src/JCurand.cpp: In function ‘jint Java_jcuda_jcurand_JCurand_curandSetPseudoRandomGeneratorSeedNative(JNIEnv*, _jclass*, _jobject*, jlong)’:
JCuda-All-0.4.0RC2-src/JCurandJNI/src/JCurand.cpp:462:17: warning: NULL used in arithmetic
JCuda-All-0.4.0RC2-src/JCurandJNI/src/JCurand.cpp: In function ‘jint Java_jcuda_jcurand_JCurand_curandSetGeneratorOffsetNative(JNIEnv*, _jclass*, _jobject*, jlong)’:
JCuda-All-0.4.0RC2-src/JCurandJNI/src/JCurand.cpp:513:19: warning: NULL used in arithmetic
Please check code of yours JCudaDriver.cpp.
Best regards.