使用GDB出现ImportError: No module named 'libstdcxx' 错误提示的解决方案
2015-09-09 17:16
633 查看
【问题描述】
错误提示:
操作系统:Ubuntu 14.04 64-bit
gcc版本:gcc-4.8.4
python版本: 2.7.6
【错误分析】
来自stackoverflow的解释
The script in libstdc++.so.6.0.19-gdb.py ought to be fixed as per that email message, and possibly ported to python 3 (I haven’t looked at it really closely yet). But if your target is compiled with the system version of gcc (i.e. you’re not cross-compiling nor using a version of gcc different from the one that came with the system), you can just do (gdb) python sys.path.append(“/usr/share/gcc-4.8/python”); then it won’t matter that the libstdc++.so.6.0.19-gdb.py script adds a nonexistent directory to the path.
这是个bug在很早的版本,不过新的libstdc++.so.6.0.19-gdb.py已经修复了这个import导入问题,如果还会出现这种问题,可能是交叉编译或者py脚本的gcc编译版本与运行环境不同导致的。
【解决方案】
在gdb控制台中,输入
【感悟】
gdb打印居然是依赖python库文件,好神奇啊。
错误提示:
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Traceback (most recent call last): File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module> from libstdcxx.v6.printers import register_libstdcxx_printers ImportError: No module named 'libstdcxx'
操作系统:Ubuntu 14.04 64-bit
gcc版本:gcc-4.8.4
python版本: 2.7.6
【错误分析】
来自stackoverflow的解释
The script in libstdc++.so.6.0.19-gdb.py ought to be fixed as per that email message, and possibly ported to python 3 (I haven’t looked at it really closely yet). But if your target is compiled with the system version of gcc (i.e. you’re not cross-compiling nor using a version of gcc different from the one that came with the system), you can just do (gdb) python sys.path.append(“/usr/share/gcc-4.8/python”); then it won’t matter that the libstdc++.so.6.0.19-gdb.py script adds a nonexistent directory to the path.
这是个bug在很早的版本,不过新的libstdc++.so.6.0.19-gdb.py已经修复了这个import导入问题,如果还会出现这种问题,可能是交叉编译或者py脚本的gcc编译版本与运行环境不同导致的。
【解决方案】
在gdb控制台中,输入
python sys.path.append("/usr/share/gcc-4.8/python");
【感悟】
gdb打印居然是依赖python库文件,好神奇啊。
相关文章推荐
- Python动态类型的学习---引用的理解
- Python3写爬虫(四)多线程实现数据爬取
- 垃圾邮件过滤器 python简单实现
- 下载并遍历 names.txt 文件,输出长度最长的回文人名。
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例
- Python中map()函数浅析
- Python将excel导入到mysql中
- Python在CAM软件Genesis2000中的应用
- 使用Shiboken为C++和Qt库创建Python绑定
- FREEBASIC 编译可被python调用的dll函数示例
- Python 七步捉虫法