Thursday, March 3, 2011

Skipping incompatible library when searching, linker error

While compiling or linking libraries, the linker searches for matches in the library path. If a match is found based on file name, but the objects in the library are built for a different architecture than the executable being linked, the following message may be printed:
/usr/bin/ld: skipping incompatible /lib/libmylib.a when search for -lmylib
 This error is only harmful if a library with the right format cannot be found. I have encountered this problem when compiling for 32-bit architectures on a 64-bit machine. The solution usually involves recompiling the library for the target architecture.