latest mini-ct script and NPTL versus linuxthreads

Hinko Kocevar
Sun Dec 4 22:32:00 GMT 2005

Robert P. J. Day wrote:

> hinko kocevar wrote recently of trying to build a toolchain using the mini-ct
> script for the ARM architecture using linuxthreads and having to touch the
> file ${HEADERS_DIR}/link.h (which i've never known to be an issue before).

Me neither but looks like it is missed when copying the heads over to 
the sysroot dir-- my guess.

> at the moment, that mini script is set up to build *only* with NPTL so that
> might be part of the problem.  my final enhancement to the script (short of
> fixing obvious bugs, of course) will be to add the choice of using either NPTL
> or linuxthreads.

For now (at least to my knowledge) there is no support for nptl ARM 
arch, so the whole nptl thing is not my concern - at least for now:)

> as i understand it, the difference between the two approaches (using recent
> GNU software) is that linuxthreads still requires unloading the separate
> glibc-linuxthreads tarball into the glibc directory, then setting "enable-add-ons"
> appropriately.
> NPTL, on the other hand, is already part of the glibc tarball so one need only
> set "enable-add-ons" BUT one must also apply a single patch
> glibc-5070_all_cross-compile-nptl.patch.  i'm not sure what will happen if
> you mix the two strategies.  i'm sort of surprised that hinko actually got a
> working toolchain from that mini script given that i still haven't officially
> added linuxthreads support.  but i'll get to that in a day or two.

It's like that -
I also changed the nptl stuff in your mini-ct script to linuxthreads to 
get it working. I was a bit intimidated by the size of (for 
my initial buildroot hacks) and took the mini-ct instead for testing out 
configurations that may lead me to working softfloat ARM toolchain. [See 
the scripts below for all the modifications I did]. Anyways, I got it 
working with gcc 3.4.1, glibc 2.3.5 and 2.3.6, binutils 2.16.1 and 
2.6.12 kernel headers. Of course glibc-linuthreads are needed too.
When I tried with gcc 4.0.2 I can't get past this error (even by adding 
--with-__thread and/or --enable-add-ons=linuxthreads):

-O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings 
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition 
-isystem ./include  -fomit-frame-pointer -fPIC -g0 -DHAVE_GTHR_DEFAULT 
  -fvisibility=hidden -DHIDE_EXPORTS -fexceptions -c 
-o libgcc/./unwind-dw2.o
In file included from ./gthr-default.h:1,
error: pthread.h: No such file or directory
In file included from ./gthr-default.h:1,
error: syntax error before '__gthread_key_t'
warning: type defaults to 'int' in declaration of '__gthread_key

That is caused by erroneous glibc-headers install, right? I eventried as 
Arno suggested few days back - copying 
linuxthreads/sysdeps/pthread/pthread.h by hand to the 
sys-root/usr/include. It turned out that I needed the contents of 
linuxthreads/sysdeps/pthread/bits/* copied to sys-root/usr/include/bits 
too, to get past the error but it failed down the line when it couldn't 
find crti.o (while compiling final gcc). Even tried to create lib and 
usr/lib (according to but to no avail... Maybe I need 
newer gcc ?!

 > it does sound promising that he got something to work, so i'll be 
 > in hearing if it produces runnable code.

I've compiled linux kernel with all gcc 3.4.1 tools I managed to build. 
Also kernel booted on real hardware. For userspace apps I took busybox 
and successfully compiled that one too (didn't test it on real HW though).

 > p.s.  again, as a warning, that mini script was written with really 
 > GNU software in mind -- gcc-4.0.x, glibc-2.3.[56] and so on.  if it 
 > to work with older software, then that's just luck. :-)

Well it does work - as long as crosstool patches are supplied;) too. I 
would prefer newer tools in my toolchain so I'll give it few more tries 
with newest gnu stuff!

I've took a look at gentoo gcc 
glibc ebuilds and how they handle the things and it cleared up some 
things for me. See comments 
about the linuxthreads, tls, and __thread switches and how they are used 
- I'm not sure but that may be gentoo specific.

-------------- next part --------------
A non-text attachment was scrubbed...
Type: application/x-shellscript
Size: 12926 bytes
Desc: not available
URL: <>
-------------- next part --------------
Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list