首页 > 其他 > 详细

chrpath工具使用

时间:2014-05-09 16:38:45      阅读:395      评论:0      收藏:0      [点我收藏+]


chrpath是用来改变程序的depends lib 的搜索路径的,比如我们一般使用
$ldd  application
    linux-vdso.so.1 =>  (0x00007fff89844000)
    libQt3Support.so.4 => /usr/lib/libQt3Support.so.4 (0x00007f53f7424000)
    libQtSql.so.4 => /usr/lib/libQtSql.so.4 (0x00007f53f71e6000)
    libQtXml.so.4 => /usr/lib/libQtXml.so.4 (0x00007f53f6f9f000)
    libQtNetwork.so.4 => /usr/lib/libQtNetwork.so.4 (0x00007f53f6c84000)
    libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0x00007f53f60d0000)
    libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x00007f53f5c99000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f53f5a7d000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f53f576d000)
    libm.so.6 => /lib/libm.so.6 (0x00007f53f54e9000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f53f52d2000)
那么我们现在想改变一个so库的搜索路径,不使用/usr/lib/下面的,而是用/usr/local/lib目录下面的,那么就可以使用chrpath工具了

$chrpath -r "/usr/local/lib/" application
application: RUNPATH=/usr/lib
application: new RUNPATH: /usr/local/lib

$chrpath -c application
application: RUNPATH=/usr/local/lib

$ldd application
    linux-vdso.so.1 =>  (0x00007fff76555000)
    libQt3Support.so.4 => /usr/local/lib/libQt3Support.so.4 (0x00007ff62e8a8000)
    libQtSql.so.4 => /usr/local/lib/libQtSql.so.4 (0x00007ff62e666000)
    libQtXml.so.4 => /usr/local/lib/libQtXml.so.4 (0x00007ff62e41d000)
    libQtNetwork.so.4 => /usr/local/lib/libQtNetwork.so.4 (0x00007ff62e0f0000)
    libQtGui.so.4 => /usr/local/lib/libQtGui.so.4 (0x00007ff62d436000)
    libQtCore.so.4 => /usr/local/lib/libQtCore.so.4 (0x00007ff62cfa6000)

chrpath工具使用,布布扣,bubuko.com

chrpath工具使用

原文:http://www.cnblogs.com/kungfupanda/p/3708799.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!