Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Dec 2006 17:01:37 +0100 (CET)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-chat@FreeBSD.ORG, jcw@highperformance.net
Subject:   Re: Static Link with Shared Object
Message-ID:  <200612281601.kBSG1bMi057091@lurza.secnetix.de>
In-Reply-To: <4586685C.1030909@highperformance.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Jason C. Wells wrote:
 > Does linking to a shared object cause the new object file to be shared also?

Yes.  As soon as a single shared object is involved, the
runtime linker comes into play.  To produce a truely static
binary -- if that's what you want --, you must use all
static libraries (*.a, not *.so), and use the -static flag.

Of course you can produce a dynamic executable with some
libraries linked statically.  For example, it might make
sense to link against the shared libc, but with static
kerberos libraries.

 > I am especially curious how the links to /usr/local are being found when 
 > I haven't used -L/usr/local.

ldconfig(8).

The -L flags tell the compiler and (compile-time) linker
ld(1) where to find the libraries.  To actually find
shared libraries at run-time, the runtime-linker rtld(1)
uses the information stored by ldconfig(8).

Please refer to the manual pages mentioned above for
details.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

I suggested holding a "Python Object Oriented Programming Seminar",
but the acronym was unpopular.
        -- Joseph Strout



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200612281601.kBSG1bMi057091>