简体   繁体   English

Debian Buster 中的库不匹配?

[英]Mismatched libraries in Debian Buster?

Note: all this work is being done on a closed network (ie no internet access).注意:所有这些工作都是在一个封闭的网络上完成的(即没有互联网接入)。

I am being bitten by the GCC 5.0+ STL changes that occurred.我被 GCC 5.0+ STL 发生的变化所困扰。 It has been stated is other posts that starting in GCC 5.0 the Standard Template Libraries went through an update where there is now legacy stl and strict compliance stl.据说其他帖子从 GCC 5.0 开始,标准模板库经历了更新,现在有旧版 stl 和严格合规 stl。 Code built with _GLIBCXX_USE_CXX11_ABI 1 does not link with code built with _GLIBCXX_USE_CXX11_ABI 0. A setting of 0 denotes legacy stl (ie std::string), whereas set to 1 constructs std::__cxx11::string.使用 _GLIBCXX_USE_CXX11_ABI 1 构建的代码不会与使用 _GLIBCXX_USE_CXX11_ABI 0 构建的代码链接。设置为 0 表示旧版 stl(即 std::string),而设置为 1 则构造 std::__cxx11::string。

OK fine that can be worked with if all user code is rebuilt to match the new libraries, but what if the debian packages are not built the same???如果重新构建所有用户代码以匹配新库,那么可以使用,但是如果 debian 包的构建不同怎么办? Now what?怎么办?

Case in point, upgraded a Debian 8.11 (Jessie) system to 10.3 (Buster), included in the upgrade was Boost and Protobuf.例如,将 Debian 8.11 (Jessie) 系统升级到 10.3 (Buster),升级中包括 Boost 和 Protobuf。 Now build my software using the default _GLIBCXX_USE_CXX11_ABI 1 and get link errors with Protobuf because it appears Protobuf was built with either pre-gcc 5.0 or ABI set to 0. Boost has other issues that it cannot find some std::__cxx1112::string (saw this once) or just std::string.现在使用默认的 _GLIBCXX_USE_CXX11_ABI 1 构建我的软件并使用 Protobuf 获取链接错误,因为它似乎是使用 pre-gcc 5.0 或 ABI 设置为 0 构建的 Protobuf。Boost 还有其他问题,它无法找到一些 std::__cxx1112::string (见过一次)或只是std :: string。

Downloaded the source for Boost, transferred to closed network, and built using ABI 1, my code now links to boost but still fails the link to protobuf.下载了 Boost 的源代码,转移到封闭网络,并使用 ABI 1 构建,我的代码现在链接到 boost,但仍然无法链接到 protobuf。 Built Boost and my code with ABI 0, now link is successful with both.使用 ABI 0 构建了 Boost 和我的代码,现在两者的链接都成功了。

Still in the process of getting a new mirror of Buster to determine if that will resolve, however the version I do have has mismatched libraries (incompatible)仍在获取 Buster 的新镜像以确定是否可以解决,但是我拥有的版本有不匹配的库(不兼容)

This is just a warning that not all may be as it seems.这只是一个警告,并非所有事情都像看起来那样。

Boost went from 1_55 to 1_67, protobuf 9 to 17, gcc 4.8 to 8. Furthermore as of the writing of this post Glassfish is not compatible with the Buster version of JDK. Boost 从 1_55 到 1_67,protobuf 9 到 17,gcc 4.8 到 8。此外,在撰写本文时,Glassfish 与 Buster 版本的 JDK 不兼容。

I was also at the question leading up to this one.我也遇到了导致这个问题的问题。

I'll pick a few points to address:我挑几个点来说明:

OK fine that can be worked with if all user code is rebuilt to match the new libraries如果重新构建所有用户代码以匹配新库,则可以正常使用

Indeed的确

but what if the debian packages are not built the same???但是如果 debian 包的构建不一样呢? Now what?怎么办?

That's not typically what happens.这通常不会发生。 Debian's QA and build servers are very highly controlled, and situations like this cannot arise unless someone slips up really badly - and even then it would immediately be noticed in testing unless the package has no users. Debian 的 QA 和构建服务器受到非常严格的控制,除非有人非常严重地滑倒,否则不会出现这种情况 - 即便如此,除非 package 没有用户,否则它会在测试中立即被注意到。

[...] get link errors with Protobuf because it appears Protobuf was built with either pre-gcc 5.0 or ABI set to 0 [...] [...] Protobuf 出现链接错误,因为看起来 Protobuf 是使用 pre-gcc 5.0 或 ABI 设置为 0 [...]

If you seem to be in this situation still, we can do some analysis like in my former answer, but this time for libprotobufX.如果您似乎仍然处于这种情况,我们可以像我之前的回答一样进行一些分析,但这次是针对 libprotobufX。 What could be happening is可能发生的是

  • you have rogue (non-distro) shared libraries in your library path(s) (check ldconfig , LD_LIBRARY_PATH, -L flags)您的库路径中有流氓(非发行版)共享库(检查ldconfig 、 LD_LIBRARY_PATH 、 -L 标志)

    Alternatively on a succesful link (so with the workaround) check with ldd on your linked binaries that it loads libprotobufXXX.so from the expected location.或者,在成功的链接上(因此使用解决方法)检查链接的二进制文件上的ldd是否从预期位置加载 libprotobufXXX.so。 If there's an unexpected location, there may be如果有一个意想不到的位置,可能会有

    • an ldconfig location as mentioned above如上所述的ldconfig位置
    • there may be RPATH / RUNPATH entries baked into the ELF image by the linker (look for -Wl,rpath or similar in your build scripts).可能有RPATH / RUNPATH条目由 linker 烘焙到 ELF 映像中(在您的构建脚本中查找 -Wl -Wl,rpath或类似内容)。 To inspect the binary to confirm this:要检查二进制文件以确认这一点:

       objdump -x binary-or-library |grep RPATH objdump -x binary-or-library |grep RUNPATH
  • your upgrade might not have successfully updated that package (check the upgrade process for errors, the status of your repo-mirror)您的升级可能没有成功更新 package(检查升级过程是否有错误,您的 repo-mirror 的状态)

  • you have a non-Debian (or non-supported) apt sources list (check /etc/apt/sources.list , /etc/apt/sources.list.d/*.list ) - those builds may not uphold the same level of distro consistency你有一个非 Debian(或不受支持)的 apt 源列表(检查/etc/apt/sources.list/etc/apt/sources.list.d/*.list ) - 这些构建可能不支持相同的级别发行版一致性

    Sideline, usually canonical launchpad PPAs tend to reuse the distro build infrastructure so I think they're usually fine as long as the distro/component entries match your installation副业,通常是规范的启动板 PPA 倾向于重用发行版构建基础架构,所以我认为只要发行版/组件条目与您的安装匹配,它们通常就可以了

    Alternatively, you can inspect the contents of the APT caches after a full apt-get update using eg或者,您可以在完整的apt-get update后检查 APT 缓存的内容,例如

     apt-cache show libprotobuf.*

    Incidentally this will also give you the maintainers and contact addresses in case you do find a problem with the package.顺便说一句,如果您确实发现 package 有问题,这也会为您提供维护人员和联系地址。 (There might be bug trackers better suited for this, I'm not known in this territory) (可能有更适合这个的错误跟踪器,我在这个领域不知道)

Hope this helps you find a lead希望这可以帮助您找到潜在客户


Still in the process of getting a new mirror of Buster to determine if that will resolve仍在获取 Buster 的新镜像以确定是否可以解决

That sounds like a good step这听起来像是一个很好的步骤

however the version I do have has mismatched libraries (incompatible)但是我拥有的版本有不匹配的库(不兼容)

I'm not sure what that means我不确定那是什么意思

Boost went from 1_55 to 1_67, protobuf 9 to 17, gcc 4.8 to 8. Furthermore as of the writing of this post Glassfish is not compatible with the Buster version of JDK. Boost 从 1_55 到 1_67,protobuf 9 到 17,gcc 4.8 到 8。此外,在撰写本文时,Glassfish 与 Buster 版本的 JDK 不兼容。

Whoa, these are big jumps.哇,这些都是大跳跃。 If JDK is an issue, IME it helps to install a Java 8 or 9 JDK/JRE and make it the default, eg如果 JDK 是个问题,IME 有助于安装 Java 8 或 9 JDK/JRE 并将其设为默认值,例如

$ update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
* 2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

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

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