public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: gcc-help@gcc.gnu.org
Subject: Re: getaddrinfo is not statically compiled
Date: Wed, 28 Apr 2010 11:26:00 -0000	[thread overview]
Message-ID: <4BD7F591.2070109@redhat.com> (raw)
In-Reply-To: <28385701.post@talk.nabble.com>

On 04/28/2010 08:35 AM, bassis wrote:
> 
> I have included the header netdb.h, where getaddrinfo is included, but gcc
> issues this warning:
> 
> warning: Using 'getaddrinfo' in statically linked applications requires at
> runtime the shared libraries from the glibc version used for linking
> 
> gcc -m32 -static -s -O2 -std=c99 -D_POSIX_C_SOURCE=200112L myprogram.c
> 
> How can I statically compile whatever file is missing ?

You can't.  The resolver library needs to load components dynamically,
and the mechanism used to do that requires that they must come from
the same glibc version as the code linked into the application.

You can either

a.  Package these libraries with your app, or
b.  Don't statically link with libc.

b. is far the best option, even if you statically link everything else.

Andrew.

http://people.redhat.com/drepper/no_static_linking.html

  reply	other threads:[~2010-04-28  8:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-28 11:15 bassis
2010-04-28 11:26 ` Andrew Haley [this message]
2010-04-28 14:52   ` bassis
2010-04-28 16:24     ` Andrew Haley
2010-04-29 16:19       ` bassis
2010-04-29 17:17         ` Andrew Haley
2010-04-29 19:38           ` bassis
2010-04-28 17:07     ` John (Eljay) Love-Jensen
2010-04-29  8:18       ` bassis
2010-04-29 21:45 Andrew Haley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BD7F591.2070109@redhat.com \
    --to=aph@redhat.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).