latest mini-ct script and NPTL versus linuxthreads

Hinko Kocevar hinko.kocevar@iskramedical.si
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 crosstool.sh (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):

/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/results/armmm/build/build-gcc/gcc/xgcc 
-B/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/results/armmm/build/build-gcc/gcc/ 
-B/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/results/armmm/tools/arm-unknown-linux-gnu/bin/ 
-B/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/results/armmm/tools/arm-unknown-linux-gnu/lib/ 
-isystem 
/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/results/armmm/tools/arm-unknown-linux-gnu/include 
-isystem 
/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/results/armmm/tools/arm-unknown-linux-gnu/sys-include 
-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 
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. 
-I/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc 
-I/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/. 
-I/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/../include 
-I/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/../libcpp/include 
  -fvisibility=hidden -DHIDE_EXPORTS -fexceptions -c 
/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/unwind-dw2.c 
-o libgcc/./unwind-dw2.o
In file included from ./gthr-default.h:1,
                  from 
/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/gthr.h:114,
                  from 
/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/unwind-dw2.c:42:
/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/gthr-posix.h:43:21: 
error: pthread.h: No such file or directory
In file included from ./gthr-default.h:1,
                  from 
/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/gthr.h:114,
                  from 
/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/unwind-dw2.c:42:
/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/gthr-posix.h:46: 
error: syntax error before '__gthread_key_t'
/work/projects/im/code/repos/trunk/src/simpl-buildroot/tmp/mini-ct/unpack/gcc-4.0.2/gcc/gthr-posix.h:46: 
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 crosstool.sh) but to no avail... Maybe I need 
newer gcc ?!

 >
 > it does sound promising that he got something to work, so i'll be 
interested
 > 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 
recent
 > GNU software in mind -- gcc-4.0.x, glibc-2.3.[56] and so on.  if it 
happens
 > 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 
(http://gentoo-portage.com/ebuild?e=sys-devel%2Fgcc%2Fgcc-4.1.0_beta20051202.ebuild&browse=true), 
glibc ebuilds and how they handle the things and it cleared up some 
things for me. See http://gentoo-portage.com/sys-libs/glibc comments 
about the linuxthreads, tls, and __thread switches and how they are used 
- I'm not sure but that may be gentoo specific.

regards,
hinko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mini-ct.sh
Type: application/x-shellscript
Size: 12926 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/crossgcc/attachments/20051204/9397191f/attachment.bin>
-------------- next part --------------
------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


More information about the crossgcc mailing list