Skipping incompatible /lib/ when searching for /lib/

By | January 5, 2018

This normally happens when compiling for an arch, say ARM, and try to execute the binary in an x86_64 arch.
But in this case, it was not this problem, I was sure that I was compiling and executing for the right places for the right archs.

The error was the following:

/opt/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible /lib/ when searching for /lib/
/opt/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/

Then I discovered that the same issue appears with
For some reason this happened after a Fedora upgrade, something got missing during the upgrade.

In order to fix it, change to the directory where your sysroot resides, in my case is /opt/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/sysroot

Edit the file usr/lib/
Change the GROUP line that is where the linker searches for libpthread:

/*GROUP ( /lib/ /usr/lib/libpthread_nonshared.a )*/
GROUP ( libpthread_nonshared.a )

Edit also the file usr/lib/

/*GROUP ( /lib/ /usr/lib/libc_nonshared.a  AS_NEEDED ( /lib/ ) )*/
GROUP ( libc_nonshared.a  AS_NEEDED ( ) )

After this, I was able again to execute the binaries as before.

Leave a Reply

Your email address will not be published. Required fields are marked *