可执行文件无法找到libstdc++版本

发布于 2025-02-11 05:54:57 字数 385 浏览 2 评论 0原文

我的机器上安装了不同的编译器。默认的libstdc ++。因此在内部 /usr /lib64。 我在“/home/myCompilers/gcc1210”文件夹中安装了GCC 12.1,并且正在使用CLION使用此编译器。可执行文件的构建正确,但是当我尝试运行此可执行文件时,它错误:

/lib64/libstdc++so.6:version“ glibcxx_3.4.29'找不到找到(./project_exe需要),

我已经使用了link_directories (/home/mycompilers/gcc1210/lib64)命令在cmake中给出libstdc ++的正确路径。因此,但是可执行文件无法在运行时使用它。

在CMAKE中提供运行时库搜索路径的正确方法是什么?

I have different compilers installed on my machine. The default libstdc++.so is inside /usr/lib64.
I installed gcc 12.1 in "/home/myCompilers/gcc1210" folder and I am using my Clion to use this compiler. The executable is built correctly, but when I try to run this executable, it errors out:

/lib64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by ./project_exe)

I have used link_directories(/home/myCompilers/gcc1210/lib64) command in CMake, to give the correct path of libstdc++.so, But the executable is not able to use it at run time.

What is the correct way to give runtime library search path in CMake.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

Smile简单爱 2025-02-18 05:54:57

我宁愿使用推荐方式设置rpath

# use, i.e. do not skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)

# when building, do not use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

# the RPATH to be used when installing
set(CMAKE_INSTALL_RPATH "")

# do not add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)

I'd rather use recommended way for setting RPATH:

# use, i.e. do not skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)

# when building, do not use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

# the RPATH to be used when installing
set(CMAKE_INSTALL_RPATH "")

# do not add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
沒落の蓅哖 2025-02-18 05:54:57

我在libstdc ++也有类似的问题
系统提供GCC -/USR/LIB64/LIBSTDC++.SO.6.0.32

最新的GCC I构建/usr/local/lib64/libstdc++so.6.0.31。
我重新链接到系统.32库。一切都起作用,但是
这不是我通常做的事情。它将暂时做。

I had a similar problem with libstdc++
System provided gcc - /usr/lib64/libstdc++.so.6.0.32

Latest gcc I built /usr/local/lib64/libstdc++.so.6.0.31.
I relinked to the system .32 library. Everything works but
this not something I normally do. It will do for now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文