/usr/bin/ld: warning: libcudnn.so.7, needed by *gpu.so, not found (try using -rpath or -rpath-link)

/usr/bin/ld: warning: libcudnn.so.7, needed by .../lib/libsunergy_gpu.so, not found (try using -rpath or -rpath-link)

1. /usr/bin/ld: warning: libcudnn.so.7, needed by /home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so, not found (try using -rpath or -rpath-link)

23:07:31 **** Build of configuration Debug for project body_pose ****
make all 
Building file: ../src/body_pose.cpp
Invoking: GCC C++ Compiler
g++ -std=c++0x -I/usr/local/include -I/usr/local/cuda-10.0/include -I"/home/strong/eclipse-work/body_pose/lib/moonergy/include" -I"/home/strong/eclipse-work/body_pose/lib/sunergy/include/track" -I/usr/local/include/opencv4/opencv2 -I"/home/strong/eclipse-work/body_pose/lib/sunergy/include" -I/usr/local/include/opencv4 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/body_pose.d" -MT"src/body_pose.o" -o "src/body_pose.o" "../src/body_pose.cpp"

Finished building: ../src/body_pose.cpp
 
Building file: ../src/human_pose.cpp
Invoking: GCC C++ Compiler
g++ -std=c++0x -I/usr/local/include -I/usr/local/cuda-10.0/include -I"/home/strong/eclipse-work/body_pose/lib/moonergy/include" -I"/home/strong/eclipse-work/body_pose/lib/sunergy/include/track" -I/usr/local/include/opencv4/opencv2 -I"/home/strong/eclipse-work/body_pose/lib/sunergy/include" -I/usr/local/include/opencv4 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/human_pose.d" -MT"src/human_pose.o" -o "src/human_pose.o" "../src/human_pose.cpp"
Finished building: ../src/human_pose.cpp
 
Building target: body_pose
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -L/usr/local/cuda-10.0/lib64 -L/home/strong/eclipse-work/body_pose/lib/sunergy/lib -Wl,-rpath='$ORIGIN/../lib/sunergy/lib' -o "body_pose"  ./src/body_pose.o ./src/human_pose.o   -lopencv_core -lcudnn -lcurand -lcuda -lcudart -lcudadevrt -lsunergy_gpu -lopencv_imgproc -lopencv_img_hash -lopencv_flann -lopencv_features2d -lopencv_imgcodecs -lopencv_shape -lopencv_calib3d -lopencv_dnn -lopencv_bioinspired -lopencv_highgui -lopencv_videoio -lopencv_datasets -lopencv_text -lopencv_ml -lopencv_cvv -lopencv_dnn_objdetect -lopencv_video -lopencv_aruco
/usr/bin/ld: warning: libcudnn.so.7, needed by /home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so, not found (try using -rpath or -rpath-link)
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnPoolingForward@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnSetPooling2dDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnGetConvolutionForwardWorkspaceSize@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnDestroyActivationDescriptor@libcudnn.so.7'
makefile:45: recipe for target 'body_pose' failed
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnDestroyTensorDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnSetFilter4dDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnDestroyPoolingDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnConvolutionBackwardFilter@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnSetTensor4dDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnCreate@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnCreatePoolingDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnDestroyConvolutionDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnCreateConvolutionDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnDestroyFilterDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnCreateFilterDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnConvolutionBackwardData@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnSetConvolutionGroupCount@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnGetConvolutionForwardAlgorithm@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnCreateTensorDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnConvolutionForward@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnSetConvolution2dDescriptor@libcudnn.so.7'
/home/strong/eclipse-work/body_pose/lib/sunergy/lib/libsunergy_gpu.so: undefined reference to `cudnnSetConvolutionMathType@libcudnn.so.7'
collect2: error: ld returned 1 exit status
make: *** [body_pose] Error 1

23:07:34 Build Finished (took 3s.139ms)

2. GCC C++ Compiler and GCC C++ Linker

GCC C++ Compiler
Includes -> Include paths(-l):
/usr/local/cuda-10.0/include

GCC C++ Linker
Libraries -> Library search path (-L):
cudnn
curand
cuda
cudart
cudadevrt

Libraries -> Libraries(-l):
/usr/local/cuda-10.0/lib64

在这里插入图片描述

3. libcudnn.so.7 => /usr/local/cuda-10.0/lib64/libcudnn.so.7 (0x00007f27880dc000)

strong@foreverstrong:~/eclipse-work/body_pose/lib/sunergy/lib$ pwd
/home/strong/eclipse-work/body_pose/lib/sunergy/lib
strong@foreverstrong:~/eclipse-work/body_pose/lib/sunergy/lib$ 
strong@foreverstrong:~/eclipse-work/body_pose/lib/sunergy/lib$ sudo ldconfig /usr/local/cuda-10.0/lib64/
[sudo] password for strong: 
strong@foreverstrong:~/eclipse-work/body_pose/lib/sunergy/lib$ 
strong@foreverstrong:~/eclipse-work/body_pose/lib/sunergy/lib$ ll  /usr/local/cuda-10.0/lib64/libcudnn*
lrwxrwxrwx 1 root root        13 Oct 15 20:32 /usr/local/cuda-10.0/lib64/libcudnn.so -> libcudnn.so.7*
lrwxrwxrwx 1 root root        17 Oct 15 20:32 /usr/local/cuda-10.0/lib64/libcudnn.so.7 -> libcudnn.so.7.4.2*
-rwxr-xr-x 1 root root 349141232 Oct 15 20:28 /usr/local/cuda-10.0/lib64/libcudnn.so.7.4.2*
-rw-r--r-- 1 root root 346085818 Oct 15 20:28 /usr/local/cuda-10.0/lib64/libcudnn_static.a
strong@foreverstrong:~/eclipse-work/body_pose/lib/sunergy/lib$ 
strong@foreverstrong:~/eclipse-work/body_pose/lib/sunergy/lib$ ldd ./libsunergy_gpu.so 
	linux-vdso.so.1 =>  (0x00007ffc32b2d000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f279d6d9000)
	libpython3.5m.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0 (0x00007f279d052000)
	libcudnn.so.7 => /usr/local/cuda-10.0/lib64/libcudnn.so.7 (0x00007f27880dc000)
	libcurand.so.10.0 => /usr/local/cuda-10.0/lib64/libcurand.so.10.0 (0x00007f2783f75000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2783d71000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f2783b69000)
	libnvidia-ml.so.1 => /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 (0x00007f278351e000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f278319c000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2782f86000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2782d69000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f278299f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f27a0163000)
	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f2782776000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f278255c000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f2782359000)
strong@foreverstrong:~/eclipse-work/body_pose/lib/sunergy/lib$

4. -Wl,-rpath='$$ORIGIN/../lib/sunergy/lib' -Wl,-rpath='/usr/local/cuda-10.0/lib64'

-Wl,-rpath 的作用:

  • 用于编译时指定间接引用的库位置,作用同 -Wl,-rpath-link
  • 用于运行时指定所有引用库的位置,作用同修改环境变量 LD_LIBRARY_PATH,库路径引用优先级高于 LD_LIBRARY_PATH

Project -> Properties -> C/C++ Build -> Settings -> GCC C++ Linker -> Miscellaneous -> Linker flags

-Wl,-rpath='$$ORIGIN/../lib/sunergy/lib' -Wl,-rpath='/usr/local/cuda-10.0/lib64'

在这里插入图片描述

5. Build Finished

23:32:03 **** Build of configuration Debug for project body_pose ****
make all 
Building file: ../src/body_pose.cpp
Invoking: GCC C++ Compiler
g++ -std=c++0x -I/usr/local/include -I/usr/local/cuda-10.0/include -I"/home/strong/eclipse-work/body_pose/lib/moonergy/include" -I"/home/strong/eclipse-work/body_pose/lib/sunergy/include/track" -I/usr/local/include/opencv4/opencv2 -I"/home/strong/eclipse-work/body_pose/lib/sunergy/include" -I/usr/local/include/opencv4 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/body_pose.d" -MT"src/body_pose.o" -o "src/body_pose.o" "../src/body_pose.cpp"
Finished building: ../src/body_pose.cpp
 
Building file: ../src/human_pose.cpp
Invoking: GCC C++ Compiler
g++ -std=c++0x -I/usr/local/include -I/usr/local/cuda-10.0/include -I"/home/strong/eclipse-work/body_pose/lib/moonergy/include" -I"/home/strong/eclipse-work/body_pose/lib/sunergy/include/track" -I/usr/local/include/opencv4/opencv2 -I"/home/strong/eclipse-work/body_pose/lib/sunergy/include" -I/usr/local/include/opencv4 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/human_pose.d" -MT"src/human_pose.o" -o "src/human_pose.o" "../src/human_pose.cpp"
Finished building: ../src/human_pose.cpp
 
Building target: body_pose
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -L/usr/local/cuda-10.0/lib64 -L/home/strong/eclipse-work/body_pose/lib/sunergy/lib -Wl,-rpath='$ORIGIN/../lib/sunergy/lib' -Wl,-rpath='/usr/local/cuda-10.0/lib64' -o "body_pose"  ./src/body_pose.o ./src/human_pose.o   -lopencv_core -lcudnn -lcurand -lcuda -lcudart -lcudadevrt -lsunergy_gpu -lopencv_imgproc -lopencv_img_hash -lopencv_flann -lopencv_features2d -lopencv_imgcodecs -lopencv_shape -lopencv_calib3d -lopencv_dnn -lopencv_bioinspired -lopencv_highgui -lopencv_videoio -lopencv_datasets -lopencv_text -lopencv_ml -lopencv_cvv -lopencv_dnn_objdetect -lopencv_video -lopencv_aruco
Finished building target: body_pose
 

23:32:06 Build Finished (took 3s.434ms)
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
"not found (try using -rpath or -rpath-link)"错误通常是由于链接器无法找到所需的库文件而引起的。要解决此错误,您可以尝试以下几种方法: 1. 确保库文件已正确安装:首先确保您所需的库文件已正确安装在系统中,并且路径被正确配置。您可以通过运行`ldconfig -p | grep <library_name>`命令来检查库文件是否被正确识别和链接。 2. 添加库文件的路径:在CMakeLists.txt文件中,使用`link_directories()`命令显式添加库文件的路径,以告诉链接器在指定路径中查找库文件。例如: ```cmake link_directories(/path/to/library) ``` 3. 使用`-Wl,-rpath`选项:在CMakeLists.txt文件中,使用`target_link_libraries()`命令时,通过`-Wl,-rpath`选项将库文件的路径传递给链接器。例如: ```cmake target_link_libraries(your_executable ${catkin_LIBRARIES} -Wl,-rpath,/path/to/library ) ``` 这将告诉链接器在指定路径中查找所需的库文件。 4. 检查环境变量:确保您的环境变量(如LD_LIBRARY_PATH)正确设置,以包含库文件的路径。 5. 检查库文件的权限:确保库文件具有正确的权限,允许ROS功能包及其可执行文件访问和链接库文件。 如果您尝试了上述方法仍然无法解决问题,可能是库文件本身存在问题或者与其他依赖库不兼容。在这种情况下,您可能需要重新安装或更新相关的库文件,并确保它们与您的系统和其他依赖项兼容。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yongqiang Cheng

梦想不是浮躁,而是沉淀和积累。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值