首页 > 其他分享 >PCL rpath解决so动态库依赖

PCL rpath解决so动态库依赖

时间:2024-10-10 11:48:57浏览次数:3  
标签:lib rpath libpcl so.1 so PCL linux 64

  1. 依赖库搜索流程
    动态库或可执行文件,是如何找到它所依赖的库的? 是按以下目录顺序来搜索:

     the RPATH binary header (set at build-time) of the library causing the lookup (if any)
     the RPATH binary header (set at build-time) of the executable
     the LD_LIBRARY_PATH environment variable (set at run-time)
     the RUNPATH binary header (set at build-time) of the executable
     base library directories (/lib and /usr/lib)
    

则当我们所依赖的so库无法找到指定库时,我们可以通过ldd xxx.so查看这个so库所依赖的其他库以及其路径

如:

 ty@ty-pc:~/anaconda3/envs/py3/lib/python3.7/site-packages/pcl$ ldd _pcl.cpython-37m-x86_64-linux-gnu.so 
    linux-vdso.so.1 =>  (0x00007ffe645f9000)
    libpcl_io.so.1.7 => /usr/lib/x86_64-linux-gnu/libpcl_io.so.1.7 
    libOpenNI.so.0 => /usr/lib/libOpenNI.so.0 (0x00007f4d70bdc000)
    libpcl_registration.so.1.7 => /usr/lib/x86_64-linux-gnu/libpcl_registration.so.1.7 
    libpcl_segmentation.so.1.7 => /usr/lib/x86_64-linux-gnu/libpcl_segmentation.so.1.7 
    libpcl_features.so.1.7 => /usr/lib/x86_64-linux-gnu/libpcl_features.so.1.7 
    libpcl_filters.so.1.7 => /usr/lib/x86_64-linux-gnu/libpcl_filters.so.1.7 
    libpcl_sample_consensus.so.1.7 => not found
    libpcl_surface.so.1.7 => /usr/lib/x86_64-linux-gnu/libpcl_surface.so.1.7
...

如果某一行末尾为not found,则说明有依赖库没有找到对应的文件。

  1. 查看RPATH
    当我们发现缺少so库时,说明此so的依赖库搜索路径中并不包含所需要的so。此时我们可以通过修改其rpath路径,将其指向包含依赖so的路径。首先查看其已有RPATH路径:

     readelf -d _pcl.cpython-37m-x86_64-linux-gnu.so | grep RPATH
     或
     
     
     patchelf --print-rpath _pcl.cpython-37m-x86_64-linux-gnu.so
    
  2. 修改RPATH
    如果以上打印出的路径中不包含步骤1中not found所需要的so库,则可以通过locate xxx.so的方式,全局搜索这个so库,然后找到其路径,例如:/usr/lib/OpenNI2/Drivers/libDummyDevice.so

首先下载patchelf源码,并进行编译安装patchelf工具:

./configure
make
sudo make install

然后执行命令,将这个依赖so所在目录设置给当前so:

 patchelf --set-rpath /usr/lib/OpenNI2/Drivers ./_pcl.cpython-36m-x86_64-linux-gnu.so
  1. 验证so依赖
    再次执行ldd xxx.so如果之前not found的那一行正确链接,说明配置ok。

标签:lib,rpath,libpcl,so.1,so,PCL,linux,64
From: https://blog.csdn.net/m0_37302966/article/details/142817352

相关文章

  • PCL Astra相机驱动&SDK
    Astra(orbbec奥比中光)乐视相机相关驱动,本教程针对Windows和Ubuntu14.04=Ubuntu18.04系统版本官网链接:https://orbbec3d.com/develop/该深度相机是乐视与奥比中光合作的体感相机,对标微软Kinect,可用于三维重建,SLAM学习,也可以作为免驱UVC摄像头体感摄像头使用相机参数:Lin......
  • Microsoft Expression Studio 4 MSDN中文旗舰版
    MicrosoftExpressionStudio4MSDN中文旗舰版复制   slice UID79171帖子5494PB币19816贡献0技术64活跃1938   楼主 发表于2010-10-1021:42:52 IP属地重庆本帖最后由slice于2010-10-1021:47编辑cn_expression_st......
  • 12G-SDI高清视频开发案例,让4K视频采集更便捷!基于Xilinx MPSoC高性能平台
    本文主要介绍基于XilinxUltraScale+MPSoCXCZU7EV的12G-SDI高清视频开发案例,适用开发环境如下:Windows开发环境:Windows764bit、Windows1064bitLinux开发环境:Ubuntu18.04.464bit开发工具包:XilinxUnified2022.2硬件平台:创龙科技TLZU-EVM评估板(基于XilinxUltraScale+......
  • HarmonyOS开发——编译报错“The reason and usedScene attributes are mandatory for
    问题现象:DevEcoStudio编译失败,提示“ThereasonandusedSceneattributesaremandatoryforuser_grantpermissions”。问题原因:从DevEcoStudioNEXTDeveloperPreview2版本开始新增规则:APP包中,所有entry和featurehap的module下的requestPermissions权限清单必须指定(......
  • python程序停到这个地方 client_socket, address = server_socket.accept()
    停到这个地方 client_socket,address=server_socket.accept() 这行代码是在等待客户端的连接请求。server_socket.accept()是一个阻塞调用,它会一直等待有客户端连接上来,然后返回一个新的套接字对象client_socket和客户端的地址address。如果你的程序在这一行停止,可能......
  • Linux网络(二)——socket、BIO、epoll原理
    二、内核如何与用户进程协作//创建Socket的c语言程序...intmain(){ intsk=socket(PF_INET,SOCK_STREAM,0); //忽略bind和accept ... } 2.1读取视角:Linuxsocket结构2.1.1socket源码//代码:/include/linux/net.hstructsocket{ socket_state state; shor......
  • C# Json操作
    usingNewtonsoft.Json;usingNewtonsoft.Json.Linq;usingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Linq;usingSystem.Runtime.Serialization.Json;usingSystem.Text;usingSystem.Web.Script.Serialization;namespaceHS.Common.......
  • OpenSource - License 开源项目 TrueLicense
    文章目录官网集成Demo官网https://truelicense.namespace.global/https://github.com/christian-schlichtherle/truelicense集成Demohttps://github.com/christian-schlichtherle/truelicense-maven-archetypehttps://github.com/zifangsky/LicenseDemohttp......
  • 自动化测试 | 安装selenium教程以及(ERROR: pip‘s dependency resolver does not cur
    1.在cmd里面安装selenium输入:pipinstallselenium在我这里出现了下载缓慢的问题,一直卡了半天,有同样问题的小伙伴可以试试输入下面这个进行安装,会更快一点:pip--default-timeout=100installselenium-ihttps://pypi.tuna.tsinghua.edu.cn/simple之后仍然出现了:ERRO......
  • 深度学习No module named ‘torchvision.transforms.functional_tensor‘问题解决
    问题在进行深度学习训练过程中出现ModuleNotFoundError:Nomodulenamed'torchvision.transforms.functional_tensor'报错,多方查阅资料后得到了解决方案。关于我的环境:CUDA==12.1torch==2.4.1GPU==4090D原先进行深度学习用的CUDA11.3,torch1.2.1,但是在训练时出现nvrtc......