Search code examples
gccbinutilsbfd

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


I'm currently building Binutils 2.32 for the armv7l-unknown-linux-gnueabihf target, with this configure command:

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

I ran make -j3 && make install, and no errors occured.

However, when I added /usr/local/opt/arm-cross/bin to my path and ran armv7l-unknown-linux-gnueabihf-objdump, this error occured:

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

How do I fix this? I searched on Stack Overflow and Google and couldn't come up with anything.


Solution

  • You configured with --enable-shared --enable-host-shared --disable-static. This means that it is you need to make sure that the binutils programs can find the shared objects they need. Therefore, in addition to PATH, you have to use LD_LIBRARY_PATH, or otherwise make the BFD library available to your custom binutils build.

    This could however affect how other installed binutils versions find their BFD library, so it may be easier to link your version statically.