在 06-11-18,bakefish<[EMAIL PROTECTED]> 写道:
如题,一个程序我怎么才能知道用到了哪些库
参考 《Debian新维护人员手册》 4.1: 要想知道你的软件在编译的时候需要用到哪一个软件包,可以通过下面的方法: strace -f -o /tmp/log ./configure # or make instead of ./configure, if the package doesn't use autoconf for x in `dpkg -S $(grep open /tmp/log|\ perl -pe 's!.* open\(\"([^\"]*).*!$1!' |\ grep "^/"| sort | uniq|\ grep -v "^\(/tmp\|/dev\|/proc\)" ) 2>/dev/null|\ cut -f1 -d":"| sort | uniq`; \ do \ echo -n "$x (>=" `dpkg -s $x|grep ^Version|cut -f2 -d":"` "), "; \ done 要准确地找到构建/usr/bin/foo所需要的软件包,执行: objdump -p /usr/bin/foo | grep NEEDED 而要列出每一个库,如libfoo.so.6,执行: dpkg -S libfoo.so.6 现在你已经安装了"Build-deps"一项列出的每一个-dev软件包。如果你使用ldd来完成这个任务,它会把并非直接使用的库也报告出来,导致过多的构造依赖。 -- Wang Xu