linux库依赖关系,linux – 库部署与未使用的直接依赖关系

由于-u开关打印.

在ldd的手册页中

-u,--unused

Print unused direct dependencies. (Since glibc 2.3.4.)

What is an unused direct dependency (this sounds contradictory to me)?

这是恕我直言 – >你建立二进制文件库是不必要的.

gcc -L -Wall -o assistant assistant.c -lA -lB -lC

它会将所有A B C列为依赖项,但它们实际上可能不会用于二进制文件.

主要原因是Makefile中的通用LDFLAGS.

Is it possible to find out if Qt Assistant actually requires an unused

direct dependency (other then starting it and waiting for an error)?

不,我认为,因为只有在您调用特定功能时才可以使用它.

也有可能你可以使用这个不会看到错误.

如果你决定这样做仍然.有一种疯狂的方式.列出所有调用的函数,然后检查所需的库. (不确定这个,但我认为基于类似的逻辑ldd打印这个.)

根据man page ldd可能运行二进制文件.所以基本上可以是你提到的场景.但并不广泛.

Be aware,however,that in some circumstances,some versions of

ldd may attempt to obtain the dependency information by directly

executing the program. Thus,you should never employ ldd on an

untrusted executable,since this may result in the execution of arbitrary code.

What exactly is the difference between the above command lines? Why

does the first list libQt5sql but the second doesn’t?

差异是-r

-r,--function-relocs

Perform relocations for both data objects and functions,and

report any missing objects or functions (ELF only).

简而言之,它处理加载的库函数.

建议在redhat上的this bug中使用ldd -u -r.

要了解有关重定位处理的更多信息,请阅读this oracle doc.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值