gpt4 book ai didi

c++ - Debian Buster中的库不匹配?

转载 作者:行者123 更新时间:2023-12-02 10:31:15 25 4
gpt4 key购买 nike

注意:所有这些工作都是在封闭的网络上完成的(即无法访问互联网)。

我被发生的GCC 5.0+ STL更改所困扰。据说还有其他帖子,从GCC 5.0开始,标准模板库进行了更新,现在有旧版STL和严格合规STL。使用_GLIBCXX_USE_CXX11_ABI 1构建的代码不会与使用_GLIBCXX_USE_CXX11_ABI 0构建的代码链接。设置为0表示旧式STL(即std::string),而设置为1则构造std::__ cxx11::string。

好的,如果重建所有用户代码以匹配新的库,可以使用,但是如果debian软件包的构建不是相同的呢?怎么办?

例如,将Debian 8.11(Jessie)系统升级到10.3(Buster),升级中包括Boost和Protobuf。
现在,使用默认的_GLIBCXX_USE_CXX11_ABI 1来构建我的软件,并获得与Protobuf的链接错误,因为Protobuf似乎是在pre-gcc 5.0或ABI设置为0的情况下构建的。Boost还有其他问题,无法找到一些std::__ cxx1112::string(看到一次)或只是std::string。

下载了Boost的源代码,转移到封闭的网络,并使用ABI 1进行构建,我的代码现在链接到boost,但仍然无法链接到protobuf。
使用ABI 0构建Boost和我的代码,现在两者都成功链接。

仍在获取新的Buster镜像以确定是否可以解决的过程中,但是我确实拥有的版本库不匹配(不兼容)

这仅是警告,并非所有情况都如此。

Boost从1_55到1_67,protobuf 9到17,gcc 4.8到8。此外,在撰写本文时,Glassfish与Buster版本的JDK不兼容。

最佳答案

我当时也在question leading up to this

我将提出几点要解决的问题:

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??? Now what?



通常不会发生这种情况。 Debian的QA和构建服务器受到非常严格的控制,除非有人严重滑倒,否则不会出现这种情况-即便如此,除非软件包没有用户,否则在测试中会立即注意到它。

[...] get link errors with Protobuf because it appears Protobuf was built with either pre-gcc 5.0 or ABI set to 0 [...]



如果您似乎仍然处于这种情况下,我们可以像我以前的回答一样进行一些分析,但是这次是libprotobufX。可能发生的是
  • 您的库路径中有恶意(非发行版)共享库(请检查ldconfig,LD_LIBRARY_PATH和-L标志)

    或者,在成功的链接上(使用解决方法),在链接的二进制文件上检查ldd,以从预期的位置加载libprotobufXXX.so。如果有意外的位置,则可能有
  • 如上所述的ldconfig位置
  • 链接器可能会将RPATH / RUNPATH条目烘焙到ELF图像中(在构建脚本中查找-Wl,rpath或类似内容)。要检查二进制文件以确认这一点:
      objdump -x binary-or-library |grep RPATH
    objdump -x binary-or-library |grep RUNPATH
  • 您的升级程序可能尚未成功更新该软件包(请检查升级过程中的错误,存储镜像的状态)
  • 您有一个非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



    另外,您也可以在完整的apt-get update之后使用以下命令检查APT缓存的内容:
     apt-cache show libprotobuf.*

    顺便说一句,这也可以为您提供维护者和联系地址,以防万一您发现软件包有问题。 (可能有一些更适合于此的错误跟踪器,在该地区我不知道)

  • 希望这可以帮助您找到线索

    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)



    我不确定那是什么意思

    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.



    哇,这些都是很大的跳跃。如果存在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

    关于c++ - Debian Buster中的库不匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62156231/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com