JCuda错误:未定义符号:Pointer_buffer
我正在尝试在 Debian Linux(32 位)中运行 JCuda 示例。由于 JCuda 网站上没有适用于 Linux x86 的二进制文件,因此我编译了这些库。现在我正在尝试运行 DeviceQuery 示例,但出现以下错误:
Error while loading native library "JCudaDriver-linux-x86" with base name "JCudaDriver" Operating system name: Linux Architecture : i386 Architecture bit size: 32 Stack trace from the attempt to load the library as a resource: java.lang.NullPointerException: No resource found with name '/lib/libJCudaDriver-linux-x86.so' at jcuda.LibUtils.loadLibraryResource(LibUtils.java:144) at jcuda.LibUtils.loadLibrary(LibUtils.java:80) at jcuda.driver.JCudaDriver.(JCudaDriver.java:192) at jcudatest.JCudaTest.main(JCudaTest.java:29) Stack trace from the attempt to load the library as a file: java.lang.UnsatisfiedLinkError: /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so: /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so: undefined symbol: Pointer_buffer at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1732) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1028) at jcuda.LibUtils.loadLibrary(LibUtils.java:90) at jcuda.driver.JCudaDriver.(JCudaDriver.java:192) at jcudatest.JCudaTest.main(JCudaTest.java:29) Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load the native library at jcuda.LibUtils.loadLibrary(LibUtils.java:122) at jcuda.driver.JCudaDriver.(JCudaDriver.java:192) at jcudatest.JCudaTest.main(JCudaTest.java:29) Java Result: 1
我相信这里的错误与未定义的符号 Pointer_buffer 有关,因为我在 /lib 上创建了符号链接,并且该文件夹位于 PATH 变量上(我可以看到它)将符号链接解析为/home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so 就像它应该的那样)。
一切都可以与 Cuda 一起使用,因为我可以编译和运行 Cuda 示例。 Cuda版本是4.0.17和JCuda 0.4.0-beta1(从JCuda网站我可以看到版本0.4.0-beta1。这些库已经为CUDA 4.0(build 17)编译了所以我想我这里也没有任何不兼容性)。
我正在 Netbeans 上设置我的项目,并且我已包含 JcudaJava 文件夹中存在的源文件。我是否需要包含 JCudaDriverJNI 和 JCudaRuntimeJNI 文件夹中的 cpp 和 hpp 文件(我以前从未使用过 JNI,真的不知道我需要包含什么)。
预先感谢,
锐
I am trying to run a JCuda example in Debian Linux (32bit). Since there is no binaries available on JCuda website for Linux x86, I've compliled the libraries. Now I'm trying yo run the DeviceQuery example but I get the following errors:
Error while loading native library "JCudaDriver-linux-x86" with base name "JCudaDriver" Operating system name: Linux Architecture : i386 Architecture bit size: 32 Stack trace from the attempt to load the library as a resource: java.lang.NullPointerException: No resource found with name '/lib/libJCudaDriver-linux-x86.so' at jcuda.LibUtils.loadLibraryResource(LibUtils.java:144) at jcuda.LibUtils.loadLibrary(LibUtils.java:80) at jcuda.driver.JCudaDriver.(JCudaDriver.java:192) at jcudatest.JCudaTest.main(JCudaTest.java:29) Stack trace from the attempt to load the library as a file: java.lang.UnsatisfiedLinkError: /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so: /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so: undefined symbol: Pointer_buffer at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1732) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1028) at jcuda.LibUtils.loadLibrary(LibUtils.java:90) at jcuda.driver.JCudaDriver.(JCudaDriver.java:192) at jcudatest.JCudaTest.main(JCudaTest.java:29) Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load the native library at jcuda.LibUtils.loadLibrary(LibUtils.java:122) at jcuda.driver.JCudaDriver.(JCudaDriver.java:192) at jcudatest.JCudaTest.main(JCudaTest.java:29) Java Result: 1
I belive the error here is related to that undefined symbol Pointer_buffer, since I created symbolic links on /lib and this folder is on PATH variables (I can see it resolving the symboling link to /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so like it was supposed).
Everything is working with Cuda as well, since I can compile and run Cuda examples. Cuda version is 4.0.17 and JCuda 0.4.0-beta1 (from JCuda website I can see Version 0.4.0-beta1. These libraries have been compiled for CUDA 4.0 (build 17) so I think I don't have any incompatibility here as well).
I am setting up my project on Netbeans, and I've included the source files present on JcudaJava folder. Do I need to include the cpp and hpp file from JCudaDriverJNI and JCudaRuntimeJNI folders (I never worked with JNI before, don't really know what I need to include).
Thanks in advance,
Rui
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“未定义的符号”意味着未找到符号(变量、函数)的定义。 JCuda 在 CommonJNI/PointerUtils.cpp 中定义了
Pointer_buffer
,因此在 .so 中包含 PointerUtils.o 肯定存在一些问题。你编译的时候有没有什么错误?An "undefined symbol" means that a definition for the symbol (variable, function) was not found. JCuda defines
Pointer_buffer
in CommonJNI/PointerUtils.cpp so there must have been some problem including PointerUtils.o in the .so. Were there any errors when you compiled?