大网数据广告活动
服务器运维问答

Package and Deploy Linux Binary

· 52CE 我爱测

Can you list all .so files referenced by a binary? This is to package and deploy a binary along with all .so files it needs to servers. As I understand it you can't statically link with .so files, but you can probably make a self…

问题原文

原帖链接 · jcarpenter2 · CC BY-SA 3.0

Can you list all .so files referenced by a binary?

This is to package and deploy a binary along with all .so files it needs to servers. As I understand it you can't statically link with .so files, but you can probably make a self extracting archive.

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 3.0

This is what the ldd program does. Given the path to an executable and no other options, it will list the shared libraries the program needs, and the current paths of those shared libraries on the system (if present).

For example:

$ ldd /usr/bin/bash
    linux-vdso.so.1 (0x00007ffc19b28000)
    libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fb815da1000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fb815b9d000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fb8157d7000)
    /lib64/ld-linux-x86-64.so.2 (0x000056504b842000)

So, yes you can, but that doesn't really help you as much as you think.

Rather than manually creating your own archives, you should use a packaging system such as rpm or deb, depending on the target distribution, or the more recent Flatpak (which is probably going to be how most apps get distributed in future Linux distributions).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-02-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。