public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* static linking warning
@ 2008-02-14 21:34 burlen
  2008-02-15  1:26 ` Brian Dessent
  0 siblings, 1 reply; 2+ messages in thread
From: burlen @ 2008-02-14 21:34 UTC (permalink / raw)
  To: gcc-help

Hi all,

I am encountering a warning which I would like to understand a little 
better.

p4_secure.c: warning: Using 'getpwuid' in statically linked applications 
requires at runtime the shared libraries from the glibc version used for 
linking

I am building an app with the --static flag. I have attempted to make 
sure that all of the components of this app are linked against 
statically linked libraries. This call is part of the underlying system. 
But why would I get this warning? Why wouldn't those functions be linked 
in statically as well?

Thanks
Burlen

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: static linking warning
  2008-02-14 21:34 static linking warning burlen
@ 2008-02-15  1:26 ` Brian Dessent
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dessent @ 2008-02-15  1:26 UTC (permalink / raw)
  To: burlen; +Cc: gcc-help

burlen wrote:

> I am encountering a warning which I would like to understand a little
> better.
> 
> p4_secure.c: warning: Using 'getpwuid' in statically linked applications
> requires at runtime the shared libraries from the glibc version used for
> linking

This message actually is generated by glibc and not gcc; it's a library
thing not a compiler thing. 

> I am building an app with the --static flag. I have attempted to make
> sure that all of the components of this app are linked against
> statically linked libraries. This call is part of the underlying system.
> But why would I get this warning? Why wouldn't those functions be linked
> in statically as well?

Because of NSS.  To access the passwd database might require LDAP,
kerberos/hesioid, nscd, nis, ... who knows.  The exact configuration is
not known at the time the app is linked because it depends on how the
deployment machine happens to be configured.  Remember that the whole
point of NSS is to be a modular system, the purpose of which is to allow
pluggable modules to intercept and handle these functions.  There's no
way to compile in code for every possible scenario, they are meant to be
loaded at runtime.

And besides that, in general the policy of glibc tends to frown heavily
on static linking:
<http://people.redhat.com/drepper/no_static_linking.html>.

If you want universal deployment, dynamically link against an ancient
version of glibc.  The library is forward compatible due to symbol
versioning, so it will work on any newer system.

Brian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-15  1:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-14 21:34 static linking warning burlen
2008-02-15  1:26 ` Brian Dessent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).