【问题标题】:Wrong GLIBCXX version when running a program that was compiled on the same machine运行在同一台机器上编译的程序时错误的 GLIBCXX 版本
【发布时间】:2014-11-02 15:08:56
【问题描述】:

我在同一台机器上编译、链接和运行的程序在我尝试运行时怎么可能出现 GLIBCXX 版本错误?有人知道吗?

这是我得到的错误:

0.01s$ build/test/gamgee_test
build/test/gamgee_test: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by build/test/gamgee_test)
build/test/gamgee_test: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by build/test/gamgee_test)

包括构建和运行的完整输出(VERBOSE=1)在这里: https://travis-ci.org/broadinstitute/gamgee/jobs/39751787

这在之前没有发生,只是在我切换到 cmake 之后发生。同样的代码也可以在 Clang 中正常运行(使用捆绑版本的 libstdc++,因为我没有在 VM 上安装 libc++)。该日志在这里:https://travis-ci.org/broadinstitute/gamgee/jobs/39751786

很疑惑。

【问题讨论】:

    标签: c++ cmake libstdc++


    【解决方案1】:

    运行时路径与编译路径不同。听起来您的系统上有多个版本的库。检查您的 LD_LIBRARY_PATH 环境变量并使用 ldd 调用您的可执行文件以查看它正在使用/尝试使用哪些库。

    【讨论】:

    • 如何检查运行时并清楚地编译库路径?我以为ld --verbose | grep SEARCH 告诉我编译和运行时的搜索路径。
    • 你是对的,从 gcc 4.6 安装了第二个 libstdc++。经过一番折腾,我能够通过从 /usr/lib64 链接它来用 4.9.1 stdlibc++ 替换它。这是我可以愚弄 travis 的唯一方法(因为我无法将 /usr/lib64 广告添加到 ld.so.conf)。
    猜你喜欢
    • 1970-01-01
    • 2017-08-23
    • 1970-01-01
    • 2012-04-09
    • 2015-03-09
    • 1970-01-01
    • 1970-01-01
    • 2021-08-20
    • 1970-01-01
    相关资源
    最近更新 更多