【Linux】中标麒麟操作系统下gdb的安装/Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.166.ns6.0.5.

在国产中标麒麟操作系统上,由于gdb无法正常使用,通过尝试使用yum安装debuginfo失败,作者选择直接从源码编译安装gdb。下载gdb 7.8版本,经过配置、编译和安装步骤,最终成功解决gdb的缺失问题,使其能够正常运行并调试程序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

近日需要调一个在国产操作系统中标麒麟的一个程序,发现gdb不好使。

查看自带gdb版本信息

[root@localhost gdb-7.8]# gdb --version
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.ns6.0.2)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mips64el-neokylin-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

gdb进入程序后

Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.166.ns6.0.5.mips64el keyutils-libs-1.4-4.ns6.0.mips64el krb5-libs-1.10.3-42.ns6.0.mips64el libacl-2.2.49-6.ns6.0.mips64el libattr-2.4.44-7.ns6.0.mips64el libcom_err-1.41.12-18.ns6.0.1.mips64el libselinux-2.0.94-5.3.ns6.0
:/mnt/hgfs/UbuntuShared/3.4rockx_face_camera_vi$ arm-linux-gnueabihf-gdb ./rockx_face_camera_vi GNU gdb (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.2.1.20190227-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-pc-linux-gnu --target=arm-linux-gnueabihf". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://bugs.linaro.org/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./rockx_face_camera_vi...done. (gdb) target remote 192.168.100.75:1234 Remote debugging using 192.168.100.75:1234 Reading symbols from /opt/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/lib/ld-linux-armhf.so.3...done. 0xa6ed0a00 in _start () from /opt/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/lib/ld-linux-armhf.so.3 (gdb) break main Breakpoint 1 at 0x11ddc: file rockx_face_camera_vi.cpp, line 76. (gdb) continue Continuing. warning: Could not load shared library symbols for 47 libraries, e.g. /oem/usr/lib/libeasymedia.so.1. Use the "info sharedlibrary" command to see the complete listing. Do you need "set solib-search-path" or "set sysroot"? warning: Could not load shared library symbols for /usr/lib/libv4l/plugins/libv4l-mplane.so. Do you need "set solib-search-path" or "set sysroot"? [New Thread 1096.1913] Thread 1 "rockx_face_came" hit Breakpoint 1, main (argc=1, argv=0xaeb0ed24) at rockx_face_camera_vi.cpp:76 76 memset(&vi_chn_attr, 0, sizeof(VI_CHN_ATTR_S)); (gdb) next 77 vi_chn_attr.pcVideoNode = CAMERA_PATH; // Path (gdb) 78 vi_chn_attr.u32Width = 1920; // Width (gdb) next 79 vi_chn_attr.u32Height = 1080; // Height (gdb) next 80 vi_chn_attr.enPixFmt = IMAGE_TYPE_NV12; // ImageType (gdb) next 81 vi_chn_attr.enBufType = VI_CHN_BUF_TYPE_MMAP; // BufType (gdb) next 82 vi_chn_attr.u32BufCnt = 3; // Cnt (gdb) next 83 vi_chn_attr.enWorkMode = VI_WORK_MODE_NORMAL; // Mode (gdb) next 84 ret = RK_MPI_VI_SetChnAttr(CAMERA_ID, CAMERA_CHN, &vi_chn_attr); (gdb) next 85 if (ret) (gdb) next 87 printf("Vi Set Attr Failed.....\n"); (gdb) next 88 return 0; (gdb) next 92 printf("Vi Set Attr Success.....\n"); (gdb) next 95 ret = RK_MPI_VI_EnableChn(CAMERA_ID, CAMERA_CHN); (gdb) next [New Thread 1096.2089] [New Thread 1096.2090] 96 if (ret) (gdb) next 99 return 0; (gdb) next 103 printf("Vi Enable Attr Success.....\n"); (gdb) next 107 memset(&venc_chn_attr, 0, sizeof(VENC_CHN_ATTR_S)); (gdb) next 110 venc_chn_attr.stVencAttr.u32VirWidth = 1920; (gdb) next 111 venc_chn_attr.stVencAttr.u32VirHeight = 1080; (gdb) next 112 venc_chn_attr.stVencAttr.imageType = IMAGE_TYPE_NV12; (gdb) next 113 venc_chn_attr.stVencAttr.enType = RK_CODEC_TYPE_H264; (gdb) next [New Thread 1096.2167] 114 venc_chn_attr.stVencAttr.u32Profile = 66; (gdb) next 115 venc_chn_attr.stRcAttr.enRcMode = VENC_RC_MODE_H264CBR; (gdb) next 121 venc_chn_attr.stRcAttr.stH264Cbr.u32SrcFrameRateNum = 25; (gdb) next 122 ret = RK_MPI_VENC_CreateChn(VENC_CHN, &venc_chn_attr); (gdb) next 123 if (ret) (gdb) next 125 printf("ERROR: Create venc failed!\n"); (gdb) next 126 exit(0); (gdb) next 129 ret = RK_MPI_VI_StartStream(CAMERA_ID, CAMERA_CHN); (gdb) next 130 if (ret) (gdb) next 148 cerr<<"pthread create successed...."<<endl; (gdb) next 151 rockx_config_t *face_detect_config = rockx_create_config(); (gdb) next 152 ret=rockx_add_config(face_detect_config, ROCKX_CONFIG_DATA_PATH, "/userdata/rockx_data"); (gdb) next warning: Could not load shared library symbols for 6 libraries, e.g. /usr/lib32/librknn_runtime.so. Use the "info sharedlibrary" command to see the complete listing. Do you need "set solib-search-path" or "set sysroot"? [New Thread 1096.2250] 153 if (ret != ROCKX_RET_SUCCESS) (gdb) next 155 printf("Failed to add config: error code = %d\n", ret); (gdb) next 160 printf("Invalid parameter: check key or value\n"); (gdb) next 161 break; (gdb) next 163 printf("Memory allocation failed\n"); (gdb) next 164 break; (gdb) next 166 printf("类型不匹配 ...\n"); (gdb) next 175 printf("rockx_add_config successfully\n"); (gdb) next 178 rockx_handle_t face_detect_handle=NULL; (gdb) next 181 printf("第一处断点\n"); (gdb) next 183 rockx_module_t face_detect_module = ROCKX_MODULE_FACE_DETECTION_V2; (gdb) next 187 rockx_release_config(face_detect_config); // 释放配置 (gdb) next 188 printf("第三处断点\n"); (gdb) next 189 if (face_detect_ret != ROCKX_RET_SUCCESS) (gdb) next 191 printf("rockx_create face_detect failed...\n"); (gdb) next 192 return -1; (gdb) next 200 rv1126_rockx_image.width = WIDTH; (gdb) next 201 rv1126_rockx_image.height = HEIGHT; (gdb) next 202 rv1126_rockx_image.pixel_format = ROCKX_PIXEL_FORMAT_YUV420SP_NV12; (gdb) next 203 printf("Image params: width=%d, height=%d, format=%d\n", (gdb) next 206 rv1126_rockx_image.pixel_format); (gdb) next 203 printf("Image params: width=%d, height=%d, format=%d\n", (gdb) next 217 mb = RK_MPI_SYS_GetMediaBuffer(RK_ID_VI, CAMERA_CHN, -1); (gdb) next 218 if (!mb) (gdb) next 220 printf("Get Vi Stream break....\n"); (gdb) next 297 RK_MPI_VENC_DestroyChn(VENC_CHN); (gdb) next 298 RK_MPI_VI_DisableChn(CAMERA_ID, CAMERA_CHN); (gdb) next cv::String::String (this=0xaeb0ebe8, s=0x11cc3f "") at ./arm_opencv_source/include/opencv2/core/cvstd.hpp:599 599 if (!s) return; (gdb) next 601 if (!len) return; (gdb) next 603 } (gdb) next cv::String::~String (this=0xa2170b1c <__GI__IO_file_jumps>, __in_chrg=<optimized out>) at ./arm_opencv_source/include/opencv2/core/cvstd.hpp:646 646 String::~String() (gdb) next cv::String::~String (this=0x0, __in_chrg=<optimized out>) at ./arm_opencv_source/include/opencv2/core/cvstd.hpp:648 648 deallocate(); (gdb) next 649 } (gdb) next cv::String::operator= (this=0xa2170b1c <__GI__IO_file_jumps>, str=...) at ./arm_opencv_source/include/opencv2/core/cvstd.hpp:653 653 { (gdb)
06-19
在Ubuntu上使用GDB调试程序时,如果遇到类似 `Missing separate debuginfos` 的错误提示,这通常是因为缺少目标库或二进制文件对应的调试信息。这些调试信息可以帮助GDB更好地理解代码结构、变量位置等细节。 ### 错误原因分析 该错误表示系统中缺失了特定版本的glibc、libgcc 和 libstdc++ 等依赖包的调试符号信息(debug info)。这是因为大多数Linux发行版为了减少安装包大小,默认只提供运行所需的二进制文件,而不包含详细的调试信息。 解决此问题需要手动安装相关的“调试信息”软件包。 --- ### 解决方案 #### 步骤 1:确认操作系统环境 首先,检查当前使用的操作系统及架构是否匹配所需调试信息包的要求: ```bash uname -a # 查看内核及相关版本信息 lsb_release -a # 如果有命令可用,则显示具体的 Ubuntu 版本号 ``` 注意:您提到的是 CentOS/RHEL 风格的包名(如 `.el7_9.x86_64`),而您的问题是基于 Ubuntu 发行版的环境,因此建议明确确认实际操作系统的兼容性。如果是跨平台尝试加载RPM风格的CentOS依赖到Debian系(Ubuntu)下,可能会导致更多复杂的问题。 #### 步骤 2:启用Debug Symbol Repository 对于标准的Ubuntu衍生品来说,并非直接采用CentOS那样的`debuginfo-install`工具流程。我们需要通过添加源的方式来获取deb形式的调试符号: 编辑 `/etc/apt/sources.list.d/debug-symbols.list` 文件并加入以下内容: ```text deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse deb http://ddebs.ubuntu.com $(lsb_release -cs)-security main restricted universe multiverse deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse ``` 接着更新APT缓存数据以便后续步骤能够识别新的仓库资源: ```bash sudo apt-get update ``` #### 步骤 3:查找并安装相关 Debug Package 例如,针对glibc可以这样做: ```bash sudo apt-get install libc6-dbg ``` 其他必要组件像GCC的标准C/C++库也可以一并搜索安装其dbg变体,比如`libgcc1-dbg`, 或者`libstdc++6-dbg`. --- ### 其他注意事项 有时即使完成了上述所有配置仍然无法解决问题,因为某些第三方应用程序自带静态链接库并没有公开发布配套DEBUG INFO的情况存在;此时只能依靠上游开发者提供的支持文档寻找替代办法。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值