我的机器上安装了不同的编译器。默认的libstdc++.so位于/usr/lib64 64中。我在“/home/myCompilers/ gcc 1210”文件夹中安装了gcc 12.1,我正在使用我的Clion来使用这个编译器。可执行文件的构建是正确的,但是当我尝试运行此可执行文件时,它会出错:
/lib64 64/libstdc++.so.6:未找到版本`GLIBCXX_3.4.29‘(由./project_exe要求)
我在CMake中使用了CMake命令,以给出libstdc++.so的正确路径,但是可执行文件无法在运行时使用它。
在CMake中给出运行库搜索路径的正确方法是什么。
发布于 2022-06-28 01:05:45
我宁愿使用推荐方式来设置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)
https://stackoverflow.com/questions/72780975
复制相似问题