简体   繁体   English

ldd是否报告库的所有依赖关系?

[英]Does ldd reports all dependencies of a library?

Let's suppose we have a shared library named utils.so. 假设我们有一个名为utils.so的共享库。 It may contain undefined symbols. 它可能包含未定义的符号。 Suppose also that ldd reports that this library depends on some other libraries: 还假设ldd报告该库依赖于其他一些库:

$ ldd utils.so
  library1.so
  library2.so
  ...
  libraryN.so

(Bt the way is it possible that utils.so depends not only on some shared libs, but on some static libs also?) (但是,utils.so是否可能不仅取决于某些共享库,还取决于某些静态库?)

Is it true that all undefined symbols of utils.so are resolved by libraries library1.so, library2.so, ... , libraryN.so? 确实utils.so的所有未定义符号都由库library1.so,library2.so,...,libraryN.so解析了吗?

And the same question about static libraries - is it true that all undefined symbols of a static library are resolved by libraries that ldd reports? 关于静态库的相同问题-静态库的所有未定义符号是否由ldd报告的库解决?

Is it true that all undefined symbols of utils.so are resolved by libraries library1.so, library2.so, ... , libraryN.so 确实utils.so的所有未定义符号都由库library1.so,library2.so,...,libraryN.so解析

Not necessarily. 不必要。 You can create a shared library with no dependencies but with undefined symbols. 您可以创建一个没有依赖项但带有未定义符号的共享库。 Such a library will work fine if the symbols are provided by the executable (or by shared libraries that already happen to be loaded), and fail to load otherwise. 如果这些符号是由可执行文件(或由恰好已加载的共享库)提供的,则这样的库将工作正常,否则将无法加载。 It is not recommended to create such libraries unless there's a specific need to resolve a symbol against the executable. 除非特别需要针对可执行文件解析符号,否则不建议创建此类库。

And the same question about static libraries 关于静态库的同样问题

ldd has nothing to do with static libraries, it cannot read them or report anything about them. ldd与静态库无关,它无法读取它们或报告任何有关它们的信息。 Static libraries don't have dependencies. 静态库没有依赖项。 They are more or less dumb archives of objects. 它们或多或少是对象的愚蠢档案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM