快速打包程序依赖系统库.so文件

First Post:

Last Update:

Word Count:
133

Read Time:
1 min

快速打包程序依赖系统库.so文件

将程序依赖的所有库文件拷贝出来

1
ldd helloworld | awk '{print $3}' | xargs -i cp -L {} /home/zz/lib

helloworld是可执行程序名称,/home/zz/lib是拷贝依赖库的目标文件夹

如果需要有选择的拷贝,则可以加入grep过滤一下

1
ldd helloworld | grep -E "libssl|libstdc" | awk '{print $3}' | xargs -i cp -L {} /home/zz/lib

libssl和libstdc是用于匹配需要拷贝的库文件

打赏点小钱
支付宝 | Alipay
微信 | WeChat