Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc
Warning: This HOWTO is outdated since 2006.1 as NPTL is the only alternative with 2006.1 and later


What is NPTL?

Native POSIX Thread Library (NPTL) is a thread library which is, unlike previous attempts, a very thin layer on top of the kernel. This helps to achieve a maximum of performance for a minimal price. It is intended as a replacement of the old linuxthreads library. The major benefit of NPTL over linuxthreads from a users perspective is that it's faster (refer to the PDF for benchmarks). For programmers it has the added benefit of being more posix compliant, as the name suggests.

Using NPTL

Besides that NPTL also provides signal handling on a per thread basis rather than per process, also now with NPTL support you can send the arguments with the signals.

Switching to NPTL

It is also possible to switch to NPTL on a pre-configured Gentoo system. This previously required you to unmerge linux-headers and emerge linux26-headers, where-as now you only need to make sure you have linux-headers-2.6.* installed. As mentioned above, a 2.6 kernel is required. I have assumed here that the system was already running a kernel from this series. The steps involved are:

Add the nptl and nptlonly flags to /etc/make.conf in its USE line, then run:

emerge --newuse world
Warning: nptlonly may cause problems. If you don't know what you are doing, do not set this flag.

If emerge doesn't want to rebuild anything, you might be using a Profile with NPTL (e.g. x86-default 2006.0). In this case, you're already done, but to be sure check:

USE="nptl" emerge -pv glibc

If that reveals that it refuses to accept your nptl use flag like in the following output:

Calculating dependencies... done!
[ebuild   R   ] sys-libs/glibc-2.5-r4  USE="nls -build -debug -glibc-compat20 -glibc-omitfp (-hardened) (-multilib) (-nptl) (-nptlonly) -profile (-selinux)" 0 kB

then you probably still use an old non-NPTL profile, so in this case check:

eselect profile show

and switch to a recent profile if this is in fact the case.

After rebooting you should have NPTL fully operational and running. You can verify the threading model used by libc by typing:

Code: Verify NPTL

or, if you did not specify nptlonly:


Your output should read:

Code: Output
GNU C Library 20041102 release version 2.3.4, by Roland McGrath et al.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
Compiled by GNU CC version 3.4.3 20041125 (Gentoo Linux 3.4.3-r1, ssp-3.4.3-0, pie-8.7.7).
Compiled on a Linux 2.6.8 system on 2004-12-21.
Available extensions:
       GNU libio by Per Bothner
       crypt add-on version 2.1 by Michael Glad and others
       Native POSIX Threads Library by Ulrich Drepper et al
       The C stubs add-on version 2.1.2.
       GNU Libidn by Simon Josefsson
       NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Thread-local storage support included.
For bug reporting instructions, please see:

Note: You may also need to re-emerge nvidia-glx if XMMS, MPlayer or X11 segfault.

If XMMS complains of inconsistency, re-emerge flac


Additional Information

According to this post [fixed 404 error] (here's the post) - You do not need to be running a 2.6 kernel to compile glibc with NPTL support. Of course with a vanilla 2.4 kernel you won't actually be able to use NPTL, that will require a kernel that has NPTL backported.

The following post is interesting too.

Common Mistakes

If emerging libc aborts with the following error: the virtual/os-headers package conflicts with another package. both can't be installed on the same system together (this refers to sys-kernel/linux-headers and linux26-headers-*) Be careful, linux26-headers has been renamed linux-headers as the Linux 2.6 kernel is now the default Gentoo kernel. Don't unmerge linux-headers!

Make sure your CHOST from /etc/make.conf is correct; if it is i386, nptl support won't be built.

Question: What machine types are supported? i686 only??? What about i386, i486, and the multitude of other architectures?
Answer: NPTL works great on my ppc and amd64 systems. On x86 you need to use i486 or later.


Retrieved from ""

Last modified: Fri, 05 Sep 2008 10:28:00 +0000 Hits: 100,130