Reputation: 1177
I have a custom library called libtaskres.so that I installed in /usr/lib/procman. My Makefile builds my program like this:
gcc -c procman.c -o obj/procman.o
gcc -c procman_power.c -o obj/procman_power.o
gcc -c procman_sched.c -o obj/procman_sched.o
gcc obj/procman.o obj/procman_power.o obj/procman_sched.o -o procman -ltaskres
But whenever I make
it, the linker returns the following error:
/usr/bin/ld: cannot find -ltaskres
collect2: error: ld returned 1 exit status
make: *** [procman] Error 1
But I did, though, included my library, using ldconfig
:
:$ cat /etc/ld.so.conf.d/procman.conf
/usr/lib/procman
:$ ls /usr/lib/procman/
total 24K
24K -rw-r--r-- 1 root root 21K 2013-Oct-31 15:06:14 libtaskres.so
I checked also:
:$ ldconfig -v | grep libtaskres
libtaskres.so -> libtaskres.so
What am I doing wrong? If I add the -L/usr/lib/procman to the linker parameters it seems to find it, but I shouldn't need it, right?
Upvotes: 0
Views: 761
Reputation: 409136
The ld.so.conf
file (and its sub-configs in ld.so.conf.d
) are for the runtime loader, not for the linker.
You still need to use the -L
options when linking.
Upvotes: 2