[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: why can gcc find -lcrypt but not -lcfont (both in /lib)?



On Tue, Sep 05, 2000 at 11:42:51PM -0400, Daniel Barclay wrote:

Simply because the -l option links static libraries, those which end
in .a and not dynamic ones (.so).

When you try to compile with libcrypt, it not uses the one in /lib; it
uses the /usr/lib/libcrypt.a instead. 

The same happens with libdb... you have libdb1.a but not libdb2.a.

I don't know what you have to do to use dynamic shared libraries, but
it is a completly different thing that static ones.

Hope this help.

> 
> How can I find out exactly where gcc and ld look for libraries? 
> 
> The manual pages mention a default search mechanism, but never say exactly 
> what that is, how it works (where it's configured on Linux or specifically 
> Debian), or what the default search directories are.
> 
> 
> The problem I'm having is that gcc seems to see some libraries in /lib and 
> not others, and similarly sees some libraries in /usr/lib but not others.
> 
> 
> For example, /lib contains both libcrypt and libctutils:
> 
>     -rw-r--r--    1 root     root        20112 Aug 14 18:11 /lib/libcrypt-2.1.3.so
>     lrwxrwxrwx    1 root     root           17 Aug 14 18:11 /lib/libcrypt.so.1 -> libcrypt-2.1.3.so
>     lrwxrwxrwx    1 root     root           19 Aug 14 18:11 /lib/libctutils.so.0 -> libctutils.so.0.0.0
>     -rw-r--r--    1 root     root        18252 Aug 14 18:11 /lib/libctutils.so.0.0.0
> 
> but gcc can see libcrypt:
> 
>     $ gcc test.c -lcrypt    
>     $
> 
> and not libctutils:
> 
>     $ gcc test.c -lctutils
>     /usr/bin/ld: cannot find -lctutils
>     collect2: ld returned 1 exit status
>     $
> 
> 
> Similarly, /usr/lib contains both libdb1 and libdb2:
> 
>     -rw-r--r--    1 root     root        80582 May  1 14:27 /usr/lib/libdb1.a
>     lrwxrwxrwx    1 root     root           16 Aug 14 22:51 /usr/lib/libdb1.so -> /lib/libdb1.so.2
>     lrwxrwxrwx    1 root     root           15 Aug 14 18:10 /usr/lib/libdb2.so.2 -> libdb2.so.2.7.7
>     -rw-r--r--    1 root     root       278604 Aug 14 18:10 /usr/lib/libdb2.so.2.7.7
> 
> but gcc can see only libdb1 but not libdb2:
> 
>     $ gcc test.c -ldb1
>     $ gcc test.c -ldb2
>     /usr/bin/ld: cannot find -ldb2
>     collect2: ld returned 1 exit status
>     $ 
> 
> 
> Any ideas?
> 
> 
> (I've run ldconfig, but does that make any difference for compiling
> and linking (vs. linking at load time)?)
> 
> 
> 
> Thanks,
> 
> Daniel
> -- 
> Daniel Barclay
> dsb@smart.net
> (Hmm.  A little worrisome:  http://www.junkbusters.com/cgi-bin/privacy
>                             http://www.anonymizer.com/snoop.cgi )
> 
> 
> -- 
> Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null

-- 
Do you really think win is easy to use?

---------------------------------------
Juli-Manel Merino Vidal <jmmv@mail.com>
    Running Debian GNU/Linux woody
---------------------------------------



Reply to: