由于-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.