当我尝试在 Ubuntu bash 中运行我的程序时,出现此错误:" /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21
When I try to run my program in Ubuntu bash I get this error : " /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found "
当我在 bash:"export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/
usr/local/lib64:/usr/lib64"中输入这个命令时,我的程序开始工作,但是每次开始使用终端时,我都必须在 bash 中输入这个命令,这很麻烦。谁能帮我永久解决这个问题
@kfsone libstdc++.so.6.0.21-gdb.py,在这个文件中:
import sys
import gdb
import os
import os.path
pythondir = '/usr/share/gcc-5.3.0/python'
libdir = '/usr/lib/../lib32'
# This file might be loaded when there is no current objfile. This
# can happen if the user loads it manually. In this case we don't
# update sys.path; instead we just hope the user managed to do that
# beforehand.
if gdb.current_objfile () is not None:
# Update module path. We want to find the relative path from libdir
# to pythondir, and then we want to apply that relative path to the
# directory holding the objfile with which this file is associated.
# This preserves relocatability of the gcc tree.
# Do a simple normalization that removes duplicate separators.
pythondir = os.path.normpath (pythondir)
libdir = os.path.normpath (libdir)
prefix = os.path.commonprefix ([libdir, pythondir])
# In some bizarre configuration we might have found a match in the
# middle of a directory name.
if prefix[-1] != '/':
prefix = os.path.dirname (prefix) + '/'
# Strip off the prefix.
pythondir = pythondir[len (prefix):]
libdir = libdir[len (prefix):]
# Compute the ".."s needed to get from libdir to the prefix.
dotdots = ('..' + os.sep) * len (libdir.split (os.sep))
objfile = gdb.current_objfile ().filename
dir_ = os.path.join (os.path.dirname (objfile), dotdots, pythondir)
if not dir_ in sys.path:
sys.path.insert(0, dir_)
# Call a function as a plain import would not execute body of the included file
# on repeated reloads of this object file.
from libstdcxx.v6 import register_libstdcxx_printers
register_libstdcxx_printers(gdb.current_objfile())
程序所依赖的库当前不在系统检查库的路径中。您可以将其添加到 .bashrc 中的LD_LIBRARY_PATH中,这样您就不必手动设置它 youelrf,或者您可以使用 ldconfig
在系统范围内添加它:
选项 1:编辑/etc/ld.so.conf
选项 2:在/etc/ld.so.conf.d 中创建一个 "locallibs.conf" 文件
无论哪种情况,您都需要两行:
/usr/local/lib
/usr/local/lib64
然后
$ sudo ldconfig
相关文章:
- 您选择的 CPU 不支持 x86-64 指令集
- std::atomic::fetch_add是x86-64上的串行化操作
- 没有规则来设定目标'/usr/lib/x86_64-linux-gnu/libboost_filesystem.so'
- Java System.loadLibrary 不会在 /usr/lib/x86_64-linux-gnu/ 文件夹中查
- Apple Mach-O-Linker 错误:在体系结构 x86-64 中找不到从(行)引用的变量
- x86-64 程序集:为什么偏移 25 字节
- 如何在 C++ 中修复"/usr/bin/ld: warning: liblber-2.4.so.2, needed by //usr/lib/x86_64-linux-gnu/libcurl-gnu
- DIS(P X)-X在GCC Linux X86-64 C 中始终导致Pointer P和Integer X的P
- 什么是 gcc Linux x86-64 C++中的有效指针
- X86-64上的C :何时通过结构/类在寄存器中返回
- 使用/usr/lib/i386-linux-gnu而不是/usr/lib/x86_64-linux-gnu在CMake中
- x86-64 调用约定中的返回值
- ./lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a 的用法是什么
- C++Mac上使用Linux库(x86_64-Apple-Darwin上的elf64-x86-64)
- 如何使用64-Linux上的C 中的新操作员动态分配大型内存,例如10 g
- x86-64上检查指针范围是否跨越N字节对齐地址的最快方法
- make[2]: *** 没有规则在 CGAL 中将目标 '/usr/lib/i386-linux-gnu/libmpfr.so'
- 如何使用C++11为x86(-64)安全地编写测试和测试集(TATAS)自旋锁
- Large PCIe DMA Linux x86-64
- (clang / llvm-mc / lld) hello world (x86-64 Windows & Linux)