No shared library in / usr / local / lib

I do not understand. I usually install third-party software in / usr / local, so the libraries are installed in / usr / local / lib and never have problems linking to these libraries. But now this suddenly doesn’t work anymore:

$ gcc -lkaytils -o test test.c
/usr/bin/ld.gold.real: error: cannot find -lkaytils
/usr/bin/ld.gold.real: /tmp/ccXwCkYk.o: in function main:test.c(.text+0x15):
error: undefined reference to 'strCreate'
collect2: ld returned 1 exit status

When I add a parameter -L/usr/local/lib, how does it work, but I have never had to use this before. Header files in / usr / local / include were found without adding -I/usr/local/include.

I am using Debian GNU / Linux 6 (Squeeze), which by default has an entry for / usr / local / lib in /etc/ld.so.conf.d/libc.conf and the ldconfig cache knows the library I am trying to use:

k@vincent:~$ ldconfig -p | grep kaytils
        libkaytils.so.0 (libc6,x86-64) => /usr/local/lib/libkaytils.so.0
        libkaytils.so (libc6,x86-64) => /usr/local/lib/libkaytils.so

So what the hell is here? Where can I check which library paths are searched by gcc by default? Maybe something is wrong there.

+5
2

gcc -print-search-dirs , . /usr/local/lib , ( ld binutils) (ld-linux.so, , ldconfig). , , , -L/usr/local/lib make ( . /configure script), .

+6

, , - - , /usr/local/include, /usr/local/lib

GCC

       CPATH specifies a list of directories to be searched as if speci‐
       fied with -I, but after any paths given with -I options on the com‐
       mand line.  This environment variable is used regardless of which
       language is being preprocessed.

       The value of LIBRARY_PATH is a colon-separated list of directories,
       much like PATH.  When configured as a native compiler, GCC tries
       the directories thus specified when searching for special linker
       files, if it can’t find them using GCC_EXEC_PREFIX.  Linking using
       GCC also uses these directories when searching for ordinary
       libraries for the -l option (but directories specified with -L come
       first).

"printenv", ,

+2

All Articles