为什么 armv7l-unknown-linux-gnueabihf-objdump 在 运行 时给出 "invalid bfd target"?

Why does armv7l-unknown-linux-gnueabihf-objdump give "invalid bfd target" when run?

我目前正在为 armv7l-unknown-linux-gnueabihf 目标构建 Binutils 2.32,使用这个 configure 命令:

chronos@localhost ~/Downloads/tarballs/binutils-2.32 $ ./configure --prefix=/usr/local/opt/arm-cross --target=armv7l-unknown-linux-gnueabihf --enable-shared --enable-host-shared --disable-static --enable-plugins --enable-gold=default --enable-ld --with-system-zlib

我运行make -j3 && make install,没有出现错误。

但是,当我将 /usr/local/opt/arm-cross/bin 添加到我的路径和 运行 armv7l-unknown-linux-gnueabihf-objdump 时,出现了这个错误:

armv7l-unknown-linux-gnueabihf-objdump: can't set BFD default target to `armv7l-unknown-linux-gnueabihf': invalid bfd target

我该如何解决这个问题?我在 Stack Overflow 和 Google 上进行了搜索,但没有找到任何结果。

您配置了 --enable-shared --enable-host-shared --disable-static。这意味着您需要确保 binutils 程序可以找到它们需要的共享对象。因此,除了 PATH,您还必须使用 LD_LIBRARY_PATH,或者以其他方式使 BFD 库可用于您的自定义 binutils 构建。

然而,这可能会影响其他已安装的 binutils 版本如何找到它们的 BFD 库,因此静态 link 您的版本可能更容易。