TL;DR: I ran make
in the wrong directory so the paths were messed up.
Problem:
>make
linking ../build/release/yubikey-personalization-gui
/usr/x86_64-suse-linux/bin/ld: cannot find -llib
...
I ran into this when compiling the Yubikey Personalisation Tool. I tracked down the -llib
call in my Makefile
which looked like this:
...
LINK = @echo linking $@ && g++
...
LIBS = $(SUBLIBS) -L/usr/lib64 -L../lib/release -llib -lyubikey -lykpers-1 -lQtGui -L/usr/lib64 -L/usr/X11R6/lib -lQtCore -lpthread
...
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
So it was setting a variable called LINK
which would print "linking" and then call g++
, which is the compiler.
Then it set the var LIBS
which would hold the ominous -llib
.
Then it composes and runs the command $(LINK) ... $(LIBS)
.
Which runs g++
with the parameter -llib
.
And what does that do? Turns out -l<something>
is telling the compiler to use the something
-library. So it asks for the library called lib
here. Which is strangely generic. I figured out that the sources came with a directory called lib/
, which was at ../lib
.
So starting make
from a directory higher up fixed it.