gpt4 book ai didi

"`GLIBCXX_3.4.32' not found" error at runtime. GCC 13.2.0(运行时出现“`GLIBCXX_3.4.32‘未找到”错误。GCC 13.2.0)

转载 作者:bug小助手 更新时间:2023-10-25 18:18:40 27 4
gpt4 key购买 nike



I am using Ubuntu 22.04.3 LTS in WSL.
I successfully built and installed GCC 13.2.0 from source. This is how I configured it:

我在WSL中使用Ubuntu 22.04.3 LTS。我从源代码上成功构建并安装了GCC 13.2.0。我是这样配置它的:


../gcc/configure --host=x86_64-pc-linux-gnu --disable-multilib --enable-languages=c,c++

g++ was then successfully installed in /usr/local/bin/g++ after all the right steps. But when I tried to run a simple Hello World application, I got the following runtime error:

然后,经过所有正确的步骤,g++被成功安装在/usr/local/bin/g++中。但是,当我尝试运行一个简单的Hello World应用程序时,我得到了以下运行时错误:


./hello: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by ./hello)

It seems that the program is not being linked with the latest built libstdc++, or maybe it wasn't properly built at all. How can I fix this error? Thank you.

该程序似乎没有与最新构建的libstdc++链接,或者可能根本没有正确构建。如何修复此错误?谢谢。


更多回答

You need to set LD_LIBRARY_PATH to the location of the built libstdc++.so.6. The system library /lib/x86_64-linux-gnu/libstdc++.so.6 is not compatible with your hello.

您需要将LD_LIBRARY_PATH设置为构建的libstdc++.so.6的位置。系统库/lib/x86_64-linux-gnu/libstdc++.so.6与您的Hello不兼容。

@273K Thanks, I found the built library, its path is /usr/local/lib64/libstdc++.so.6. But setting LD_LIBRARY_PATH to this path didn't work, it still tries to link with the system library.

@273k谢谢,我找到了构建的库,它的路径是/usr/local/lib64/libstdc++.so.6。但将LD_LIBRARY_PATH设置为此路径不起作用,它仍然尝试链接到系统库。

You should not set that file path. You should set the base path /usr/local/lib64. Usually it is described in the guide for gcc build.

您不应设置该文件路径。您应该设置基本路径/usr/local/lib64。通常在GCC的体型指南中都有描述。

@273K That worked! Thank you very much.

@273K成功了!非常感谢。

优秀答案推荐

I also encountered the same issue, and this is how I solved it:

我也遇到了同样的问题,我是这样解决的:


sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install --only-upgrade libstdc++6

It seems like the /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' is for gcc13, so we need to update this file.

/lib/x86_64-linux-gnu/libstdc++.so.6:版本`GLIBCXX_3.4.32‘是针对gcc13的,所以我们需要更新这个文件。


check the result:

检查结果:


strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX

output:

输出:


GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBCXX_3.4.29
GLIBCXX_3.4.30
GLIBCXX_3.4.31
GLIBCXX_3.4.32
GLIBCXX_TUNABLES
GLIBCXX_DEBUG_MESSAGE_LENGTH

更多回答

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