【问题标题】:arm-none-eabi-objdump: error while loading shared libraries: libdebuginfod.so.1: cannot open shared object filearm-none-eabi-objdump:加载共享库时出错:libdebuginfod.so.1:无法打开共享对象文件
【发布时间】:2021-01-21 03:08:41
【问题描述】:

如果您对此有答案或有更多信息,我将不胜感激。我正在关注advice from here,通过发布此问题以及我已经找到的答案来提供一些不请自来的帮助。

我有一个裸机 ARM 板,我正在为它构建一个跨工具链,来自 GNU binutils、gcc 和 gdb 的源代码,以及 SourceWare 的 Newlib。我让这四个工作并将 DoNothing.c 交叉构建到一个 ELF 文件中 - 但我无法用这个来反汇编它:

 $ arm-none-eabi-objdump -S DoNothing.elf

错误是:

 $ arm-none-eabi-objdump: error while loading shared libraries: libdebuginfod.so.1: cannot open shared object file: No such file or directory

我会跟进解决方案。

【问题讨论】:

    标签: shared-libraries cross-compiling elf objdump debug-information


    【解决方案1】:

    错误是正确的 - 我的系统没有安装 libdebuginfod.so.1 - 但我有另一个跨 binutils,从二进制文件安装到不同的目标,它的 objdump -S 在同一主机上工作正常。为什么一个 objdump 版本会抱怨缺少该共享库,而显然并非所有 objdump 版本都需要它?

    首先我尝试重建跨 binutils,指定 --without-debuginfod 作为配置选项。没有变化,这似乎很奇怪:当然,这应该构建不仅不使用 debuginfod 并且不以任何方式依赖它的工具。 (如果有人可以回答这个问题,或者指出我误解了什么,它可能会对人们有所帮助。)

    接下来我认为 debuginfod 是不可避免的(至少对于我从源代码构建的交叉工具而言),所以我会安装它以消除错误。它是 elfutils 软件包的一个组件,但安装适用于我的 Ubuntu 20.04 系统的最新 elfutils 并没有带来 libdebuginfod.so.1。

    我后来找到了一个,用于 Arch Linux,它的包内容表明它会 - 但它的包格式与 Ubuntu 的不匹配,安装它会涉及很多工作。相反,我选择从the Arch Linux source package 构建它。但是,在其上运行 ./configure 会产生一些非常相似的错误:

     configure: checking libdebuginfod dependencies, --disable-libdebuginfod or --enable-libdebuginfo=dummy to skip
     ...
     configure: error: dependencies not found, use --disable-libdebuginfod to disable or --enable-libdebuginfod=dummy to build a (bootstrap) dummy library.
    

    这些建议的任何组合都不会让elfutils-0.182的配置运行完成。

    问题当然是我自己缺乏理解。解决方案来自Linux From Scratch 项目:有效的方法是使用 both 建议的选项进行配置,如下所示:

    $ ./configure --prefix=/usr                \
                  --disable-debuginfod         \
                  --enable-libdebuginfod=dummy \
                  --libdir=/lib
    

    这给了一个干净的配置; make 第一次工作,就像 make check 然后 sudo make install 一样,它当然根据需要安装了 libdebuginfod.so.1。然后我有一个 arm-none-eabi-objdump 可以反汇编交叉编译的 ELF 文件而不会抱怨。

    【讨论】:

    • 为什么您没有/构建这里的 debuginfod 客户端库?您可能不需要它的功能,但它仍然应该构建。构建 binutils objdump 没有意义,然后在没有 libdebuginfod.so 的情况下中止。
    猜你喜欢
    • 2021-01-10
    • 1970-01-01
    • 2022-07-16
    • 2016-05-11
    • 2018-12-17
    • 2021-05-01
    • 2013-06-11
    • 2019-05-31
    • 2020-10-19
    相关资源
    最近更新 更多