# really dumb question about nptl

## hds

i have read a lot about this, i realize i have to use kernel 2.6, and i have to recompile at least glibc with the nptl useflag. however - what about the kernel itself?

is nptl supported by default in 2.6, or do i have to set a parameter in the kernels config?

yes, i have read the howto and the pages on the wiki, but nowhere a word about the kernel if nptl has to be set up there as well   :Embarassed: 

----------

## SPY_jmr1

as far as i know, nothing needs to be set in the kernel config.

I have never had to, if it helps any  :Smile: 

----------

## Jake

You need a 2.6 kernel but no special settings need to be enabled. When you rebuild glibc with the nptl use flag, you must build against linux26-headers. You can test for support by running

```
/lib/libc.so.6
```

You should see a line that says "Native POSIX Threads Library by Ulrich Drepper et al" if you have nptl support.

----------

## hds

thx all. as i mentioned - i was just unsure about this if i would be missing something.

so, just to make sure i understand this correctly:

using (any? i use a recent one, though..) 2.6.x kernel, nptl is available by default - correct?

well, while we are at it.. as i mentioned, i am just playing around with it to see what gives.. did you guys notice any improvments in system speed or whereever? i mean, why do so many people talk about it and like haveing it? i understand it is of interesst developing new applications, but is it of interesst running a desktop machine as well?

well, still searching a 2.6 kernel supporting reiser4 and nvidia. i just had mm-sources, but no go with nvidia (gpl stuff). now i am at nitro (latest), but now reiser4 is gone from menuconfig   :Shocked: 

well, i am sure i can figure that with nitro out while reading the complete nitro thread.

----------

## busfahrer

That's strange, I compiled my system from stage1 and have USE="nptl" in my make.conf, but /lib/libc.so.6 says nothing about it...

```

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

PARTICULAR PURPOSE.

Compiled by GNU CC version 3.4.3  (Gentoo Linux 3.4.3, ssp-3.4.3-0, pie-8.7.6.6).

Compiled on a Linux 2.6.8 system on 2004-11-17.

Available extensions:

        GNU libio by Per Bothner

        crypt add-on version 2.1 by Michael Glad and others

        linuxthreads-0.10 by Xavier Leroy

        The C stubs add-on version 2.1.2.

        GNU Libidn by Simon Josefsson

        BIND-8.2.3-T5B

        libthread_db work sponsored by Alpha Processor Inc

        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk

Thread-local storage support included.

For bug reporting instructions, please see:

<http://www.gnu.org/software/libc/bugs.html>.

```

What's wrong?

----------

## hds

 *busfahrer wrote:*   

> 
> 
>         linuxthreads-0.10 by Xavier Leroy
> 
> 

 

yes, thats definetely looks without nptl.

did you also have linux26-headers installed as you compiled it?

also recheck your useflags. common mistake is nptl vs. ntpl <g>. i use to type this one wrong all the time either  :Wink: Last edited by hds on Fri Nov 26, 2004 10:21 pm; edited 2 times in total

----------

## NeddySeagoon

hds,

ntpl makes a difference to applications (or on systems) that use large numbers of threads. e.g. Java programs

You need a kernel later than 2.6.5, the 2.6 headers, and compile glibc  with ntpl in your use flags.

I have manages to install a ntpl glibc on top of a 2.4 kernel and its not a pretty sight.  The glibc install breaks part way through then everything that needs glibc (almost everything) breaks too.

----------

## Deranger

 *hds wrote:*   

> thx all. as i mentioned - i was just unsure about this if i would be missing something.
> 
> so, just to make sure i understand this correctly:
> 
> using (any? i use a recent one, though..) 2.6.x kernel, nptl is available by default - correct?
> ...

 

Disable 4k stacks under kernel hacking and you will be able to choose Reiser4 support.

----------

## hds

yeah, thx again. well, my sys is currently busy re-compiling glibc - will report back tomorrow.

----------

## d4rk74m4

 *busfahrer wrote:*   

> That's strange, I compiled my system from stage1 and have USE="nptl" in my make.conf, but /lib/libc.so.6 says nothing about it...
> 
> ```
> 
> GNU C Library 20041102 release version 2.3.4, by Roland McGrath et al.
> ...

 

try /lib/tls/libc.so.6.  Gentoo now builds glibc twice, once with linuxthreads, once with NPTL.  The NPTL version is used by default.

----------

## busfahrer

 *d4rk74m4 wrote:*   

> try /lib/tls/libc.so.6.  Gentoo now builds glibc twice, once with linuxthreads, once with NPTL.  The NPTL version is used by default.

 

You were right, /lib/tls/libc.so.6 listed NPTL instead of linuxthreads. Also, I checked several executables with ldd `which $PROG` and they all used /lib/tls/libc.so.6, as you said.

Thanks!  :Very Happy: 

----------

## hds

 *d4rk74m4 wrote:*   

> 
> 
> try /lib/tls/libc.so.6.  Gentoo now builds glibc twice, once with linuxthreads, once with NPTL.  The NPTL version is used by default.

 

is this if you run ACCEPT_KEYWORDS="~x86"   :Shocked: 

it doesnt build it twice here:

```

bash-2.05b$ /lib/tls/libc.so.6

bash: /lib/tls/libc.so.6: No such file or directory

bash-2.05b$

```

however, nptl compiled in fine and seems to work here:

```

bash-2.05b$ /lib/libc.so.6

GNU C Library 20040808 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

PARTICULAR PURPOSE.

Compiled by GNU CC version 3.4.3  (Gentoo Linux 3.4.3, ssp-3.4.3-0, pie-8.7.6.6).

Compiled on a Linux 2.6.8 system on 2004-11-27.

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 <<<<

        BIND-8.2.3-T5B

        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk

Thread-local storage support included.

For bug reporting instructions, please see:

<http://www.gnu.org/software/libc/bugs.html>.

bash-2.05b$

```

thx again all.

however, which programs apart from glibc are worth recompiling?

btw.. would be nice if it would compile twice, because now i am unable to run my old 2.4 kernel anymore <sigh>. hopefully i get everything going with 2.6.x  :Wink: 

----------

## thecrazyperson_ws

this might be a hunch, but are you using the USE flag "nptlonly" instead of nptl?  If you use nptlonly it won't compile it with the linuxthreads fallback which is still needed with some a) very old programs or b) some recent very cranky ones (don't know which ones yet).  I'm running a full ~x86 system and glibc was compiled with the linuxthreads fallback, and I have nptl in the USE.

----------

## busfahrer

Rumour has it that nptlonly works alright, at least on amd64.

----------

## hds

 *thecrazyperson_ws wrote:*   

> this might be a hunch, but are you using the USE flag "nptlonly" instead of nptl? 

 

nope, nptl. the stable glibc doesnt have nptlonly. maybe i should upgrade glibc as well? would i then be able to boot up using kernel 2.4?

```

hds root # equery uses glibc

[ Searching for packages matching glibc... ]

[ Colour Code : set unset ]

[ Legend    : Left column  (U) - USE flags from make.conf              ]

[           : Right column (I) - USE flags packages was installed with ]

[ Found these USE variables for sys-libs/glibc-2.3.4.20040808-r1 ]

 U I

 + + nls         : <unknown>

 - - pic         : Build Position Independent Code. Needed for prelink or the hardened toolchain

 - - build       : !!internal use only!! DO NOT SET THIS FLAG YOURSELF!, used for creating build images and the first half of bootstrapping.

 + + nptl        : Enable support for NPTL

 - - erandom     : Enable erandom/frandom support in glibc for ssp

 - - hardened    : activate default security enhancements for toolchain (gcc, glibc, binutils)

 - - makecheck   : Work around to pull in packages needed to run with FEATURES=maketest

 - - multilib    : On 64bit systems, if you want to be able to compile 32bit and 64bit binaries

 - - debug       : Tells configure and the makefiles to build for debugging. Effects vary across packages, but generally it will at least add -g to CFLAGS.Remember to set FEATURES=nostrip too

 - - userlocales : build only the locales specified in /etc/locales.build

 - - debug       : Tells configure and the makefiles to build for debugging. Effects vary across packages, but generally it will at least add -g to CFLAGS.Remember to set FEATURES=nostrip too

hds root #

```

----------

## NeddySeagoon

hds,

You cannot run a 2.4 kernel with a glibc that contains ntpl.. Gentoo won't let you attempt it. You must be running kernel 2.6.5 or later to rebuild glibc with the ntpl USE flag.

Gentoo now builds glibc twice provided your system meets the following:-

a) kernel > 2.6.5 running

b) USE ntpl in your use flags

You get a version of glibc with nptl and another version without.

The nptlonly flag, saves build time by building the nptl version only.

----------

## hds

 *NeddySeagoon wrote:*   

> 
> 
> You get a version of glibc with nptl and another version without.
> 
> 

 

so - in theory - it should be possible to use a 2.4 kernel (of cause after everything is compiled with a 2.6 kernel)? if - and that might be the problem - the 2.4 kernel would look for the other glibc which has been compiled without nptl?

i will experiment with this later  :Wink: 

----------

## popcan

you can use a 2.4 kernel with nptl, it's what red hat does (and they came up with the patchset so i'd listen to them).  but it has to have the nptl patch (which none of the vanilla 2.4's do), so you can get the latest errata SRPM from one of the white box mirrors, and they have it.  they also have the full red hat enterprise 3 patchset though (which is most of the talked-about 2.6 features backported to the 2.4), but i have no idea if you can apply a resier4 patch to it.

and this is all without looking (i'm away from the servers/linux at the moment) but when i did it, i had to edit the ebuild for glibc.  there's a variable (or was) for kernel version, which you have to set to a 2.4 or it will fail saying the kernel is too old.

but if you *really* need the 2.4 due to compatability issues and want NPTL, that's the way to go.  and you won't get irritating kernel too old messages and can actually boot.

----------

## hds

ahh, i think i understood where the problem is. you are saying that glibc itself is checking "if kernel = <2.6 then say no go" - right?

well, thx - i think i will leave this task for a cold and lousy winternight then  :Wink: 

----------

## SuperJudge

I was actually wondering this myself, I redid glibc with nptl, and I was thinking I needed to rebuild my kernel, maybe it would be faster now. But I guess I don't. I've been working on a new kernel for some time now  :Surprised: 

----------

## Grahammm

 *NeddySeagoon wrote:*   

> Gentoo now builds glibc twice provided your system meets the following:-
> 
> a) kernel > 2.6.5 running
> 
> b) USE ntpl in your use flags
> ...

 

Since which build? I have glibc-2.3.4-20040808-r1 with +nptl USE flag, nptlonly is not defined at all (nor listed in etcat -u glibc), and kernel 2.6.9-r6, linux26-headers-2.6.8.1  but only a single glibc is built in /lib. The directory /lib/tls does not exist.

----------

## hds

 *Grahammm wrote:*   

> 
> 
> Since which build?

 

~x86

it started with glibc-2.3.4.20041021.ebuild

if you need this feature, i recommend enableing ~x86 in your local /etc/portage/package.keywords for glibc.

i am using glibc-2.3.4.20041102.ebuild since a few days without problems on my 2 x86 machines.

----------

## hds

 *busfahrer wrote:*   

> Rumour has it that nptlonly works alright, at least on amd64.

 

it works alright on x86 too. KDE and FluxBox work, and also the applications i use personally.

maybe we should start a thread where everyone could mention an ebuild which does not work using nptlonly?

could help the developers to have an eye on this one then, and might save us users some headache?

----------

## Deranger

I have never seen an ebuild that fails because of pure NPTL system and I have used 100% NPTL about 1,5 months.

----------

## hds

 *Oktane wrote:*   

> I have never seen an ebuild that fails because of pure NPTL system and I have used 100% NPTL about 1,5 months.

 

alright, so this is probably an urban-legend  :Wink: 

you might like to  tell this DarkStalker here:

https://forums.gentoo.org/viewtopic.php?t=258773&highlight=

maybe you can even help in the thread mentioned above, to get 2004.3 installed from scratch using nptlonly and gcc 3.4?

----------

## teilo

One important note:

If you do want to recompile glibc with nptl support, make sure you upgrade you unmerge linux-headers, and merge linux26-headers in its place before you remerge glibc.

----------

## opm8

So just to confirm,

Is there anything else that needs to be rebuilt if I re-emerge glibc with nptl?

 *teilo wrote:*   

> One important note:
> 
> If you do want to recompile glibc with nptl support, make sure you upgrade you unmerge linux-headers, and merge linux26-headers in its place before you remerge glibc.

 

----------

## teilo

 *opm8 wrote:*   

> So just to confirm,
> 
> Is there anything else that needs to be rebuilt if I re-emerge glibc with nptl?
> 
> 

 

There are certain rare programs which do not work well with nptl. You probably don't have to worry about them. For the most part, NPTL and Linux Threads use identical API calls. The behind-the-scenes implementation in glibc is what differs. Therefore most apps won't notice any difference.

----------

## opm8

Thanks.  I've converted all my Gentoo puters to NPTL just by rebuilding glibc, with no dire effects whatsoever.

 *teilo wrote:*   

>  *opm8 wrote:*   So just to confirm,
> 
> Is there anything else that needs to be rebuilt if I re-emerge glibc with nptl?
> 
>  
> ...

 

----------

## SuperJudge

I built a system with the nptl developers method, it's actually quite slick.   :Very Happy: 

----------

