glibc build error: linking nptl static - V2.17

L A Walsh
Thu Apr 4 02:48:00 GMT 2013

Carlos O'Donell wrote:
> On Mon, Apr 1, 2013 at 10:36 PM, L A Walsh <> wrote:
>> I'm getting an undefined reference when trying to build a static version
>> of glibc for standalone/rescue tool building but am getting the following
>> link error:
>> /home/tools/glibc/glibc/nptl/../nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S:80:
>> undefined reference to `__GI___pthread_unwind'
> Unfortunately this isn't a very well tested configuration.
> You have two options:
> (a) Roll up your sleeves and get dirty and find out why you have an
> undefined reference to a "global library-internal function".
> My first guess is this:
> #ifdef IS_IN_libpthread
> # ifdef SHARED
> #  define __pthread_unwind __GI___pthread_unwind
> # endif
> #else
> # ifndef SHARED
>         .weak __pthread_unwind
> # endif
> #endif
What is the ".weak" supposed to do?

note -- from below, it appears this message is taken when it is doing
the SHARED version

> You can pretty easily see that it has no conditional for !SHARED (or
> static) when building within libpthread.
    .weak __pthread_unwind  = ???

I was going to just try static first, but got an error message saying it
would need the shared available if a program wanted to use dl_open ---
I would like that option...but I don't know why I need thread unwinding
in my static lib?  It's not like I'm going to be trying to debug with it
(I hope not!)...

> Until you fix this it won't work.
Hmmm...  Why is it there?... i.e. what is the purpose of unwinding and does
it apply to a static lib?...
> (b) Back off on some of the configure flags you are using.
    Yeah, maybe, but want to get all the normal options that make sense
-- i.e.
ones you might use in single-user/no-network/not running services yet.

You can still link statically without those flags, but some cases
> might load libraries.
???  Some cases?  link without all those flags?  which flags are you
referring to?

Did you mean some of the config options?

More information about the Libc-help mailing list