clFFT 库:./main_exe:符号查找错误:./main_exe:未定义符号:clfftInitSetupData
Posted
技术标签:
【中文标题】clFFT 库:./main_exe:符号查找错误:./main_exe:未定义符号:clfftInitSetupData【英文标题】:clFFT Library : ./main_exe: symbol lookup error: ./main_exe: undefined symbol: clfftInitSetupData 【发布时间】:2021-07-27 10:52:36 【问题描述】:我的 GUI 代码编译得很好,但是当我点击一个进行一些计算的按钮时,我收到以下错误:
./main_exe: symbol lookup error: ./main_exe: undefined symbol: clfftInitSetupData
鉴于nm -D
的输出,我不明白:
nm -D /usr/local/lib64/libclFFT.so | grep clfftInitSetupData
00000000000acfb0 T clfftInitSetupData
所以这个函数clfftInitSetupData
应该被可执行文件main.exe
知道。
这里是Makefile
使用的主要部分:
OPENCL = /opt/AMDAPPSDK-3.0
INC_OPENCL = -I$(OPENCL)/include
INC_GSL = -I/usr/include/gsl
INC_CLFFT = -I/opt/clFFT/src/include
INCPATH = $(INC_OPENCL) $(INC_GSL) $(INC_CLFFT) -I/usr/share/qt4/mkspecs/linux-g++ -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I.
LINK = g++
LFLAGS = -Wl,-O3
LIBS = -L/usr/local/lib64 -lclFFT -L/usr/lib -lgsl -lgslcblas -lQtGui -lQtCore -lQtOpenGL -lpthread -L$(OPENCL)/lib/x86_64 -lOpenCL -lglut -lGL -lGLEW -lGLU -L/usr/lib -lpng
和ldd
在可执行文件上给出:
linux-vdso.so.1 (0x00007ffe3f96b000)
libclFFT.so.2 => /lib/x86_64-linux-gnu/libclFFT.so.2 (0x00007fbd53bbf000)
libgsl.so.23 => /lib/x86_64-linux-gnu/libgsl.so.23 (0x00007fbd53936000)
libgslcblas.so.0 => /lib/x86_64-linux-gnu/libgslcblas.so.0 (0x00007fbd538f5000)
libQtGui.so.4 => /lib/x86_64-linux-gnu/libQtGui.so.4 (0x00007fbd52dc0000)
libQtCore.so.4 => /lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007fbd52ab6000)
libQtOpenGL.so.4 => /lib/x86_64-linux-gnu/libQtOpenGL.so.4 (0x00007fbd529a8000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fbd52987000)
libOpenCL.so.1 => /usr/local/cuda/targets/x86_64-linux/lib/libOpenCL.so.1 (0x00007fbd5277f000)
libglut.so => not found
libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007fbd526eb000)
libGLEW.so => not found
libGLU.so.1 => /lib/x86_64-linux-gnu/libGLU.so.1 (0x00007fbd52678000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00007fbd52651000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fbd524cd000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbd5234a000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fbd52330000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbd5216f000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbd52168000)
libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fbd52122000)
libaudio.so.2 => /lib/x86_64-linux-gnu/libaudio.so.2 (0x00007fbd51f08000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbd51de9000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007fbd51db0000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fbd51b92000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fbd51ad4000)
libgobject-2.0.so.0 => /lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fbd51a7e000)
libSM.so.6 => /lib/x86_64-linux-gnu/libSM.so.6 (0x00007fbd51a73000)
libICE.so.6 => /lib/x86_64-linux-gnu/libICE.so.6 (0x00007fbd51856000)
libXrender.so.1 => /lib/x86_64-linux-gnu/libXrender.so.1 (0x00007fbd5164c000)
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007fbd5143a000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007fbd512f7000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fbd512ed000)
/lib64/ld-linux-x86-64.so.2 (0x00007fbd53d6d000)
libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007fbd512b9000)
libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007fbd511fc000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fbd511bf000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fbd511b4000)
libXt.so.6 => /lib/x86_64-linux-gnu/libXt.so.6 (0x00007fbd51149000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007fbd50f45000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fbd50ed1000)
libffi.so.6 => /lib/x86_64-linux-gnu/libffi.so.6 (0x00007fbd50ec7000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fbd50eab000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fbd50e81000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fbd50c7b000)
如果有人能看出问题所在。也许我考虑了 2 个类似的库,我暂时不知道。
【问题讨论】:
【参考方案1】:您显示了 /usr/local/lib64/ libclFFT.so 的 nm
输出,但 ldd 说它找到了 /lib/x86_64-linux-gnu/ libclFFT。所以.2.
在运行main
时将LD_LIBRARY_PATH
环境变量设置为/usr/local/lib64
,以确保它首先出现在此处。或者,将其添加到您的 /etc/ld.so.conf.d
树中(并重新运行 ldconfig
)。
【讨论】:
以上是关于clFFT 库:./main_exe:符号查找错误:./main_exe:未定义符号:clfftInitSetupData的主要内容,如果未能解决你的问题,请参考以下文章
Linux C++ libdl.so dlfcn.h使用方法(dlopen()dlsym()dlclose()dlerror())(用于动态链接库操作)(懒加载立即加载)共享库符号动态库