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

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



> From: Juli-Manel Merino Vidal <jmmv@mail.com>

> 
> 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. 

Are you sure?  The ldd command seems to show that it established
a dynamic link:


    $ gcc test.c -ldb
    $ ldd a.out
-->         libdb.so.3 => /lib/libdb.so.3 (0x40017000)
            libc.so.6 => /lib/libc.so.6 (0x40052000)
            /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
    $ gcc test.c -ldb1
    $ ldd a.out
-->         libdb.so.2 => /lib/libdb.so.2 (0x40017000)
            libc.so.6 => /lib/libc.so.6 (0x40025000)
            /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
    $ gcc test.c -ldb2
    /usr/bin/ld: cannot find -ldb2
    collect2: ld returned 1 exit status
    $ ldd a.out
    ldd: can't open a.out (No such file or directory)
    $ 
    

Or are .a libraries needed at compile/link time to establish 
the dynamic linking to .so libraries that are fully linked
at run 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 )



Reply to: