c++gcchyperlinkld

Force ld to look for libSM.so in the correct place


One of the targets in my Makefile depends on libSM.so but ld for some reason looks inside /usr/Lib/gcc/x86_64-redhat-linux/.., finds an incompatible (32-bit) version and bails. I have the correct version in /lib64 but -L/lib64 did not help.

How do I force ld to take the version under /lib64?


Solution

  • You may simply pass that lib on cmd line:

    gcc a.o b.o /usr/Lib/gcc/x86_64-redhat-linux/lib64/libSM.so ...