Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 83403 - glibc and gcc-4.0 do not get along together
Summary: glibc and gcc-4.0 do not get along together
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://lists.debian.org/debian-gcc/20...
Whiteboard:
Keywords:
: 84605 85707 86248 87293 88219 88368 88395 89998 90029 90212 94610 (view as bug list)
Depends on: 90174
Blocks:
  Show dependency tree
 
Reported: 2005-02-26 13:02 UTC by Dan Boline
Modified: 2005-09-03 20:37 UTC (History)
14 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
GCC 4 compile fix (glibc-gcc4.patch,4.87 KB, patch)
2005-03-02 15:43 UTC, Mark Loeser (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Boline 2005-02-26 13:02:52 UTC
gcc crashes during build with the error (summarized): 
/usr/include/pthread.h:655: error: array type has incomplete element type

Fix: pthread.h has #include <bits/setjmp.h>
when this is changed to #include <setjmp.h> the affected file compiles.

Reproducible: Always
Steps to Reproduce:
1.emerge gcc-4.0.0_alpha20050213.ebuild
2.
3.
Comment 1 Mark Loeser (RETIRED) gentoo-dev 2005-02-26 14:08:26 UTC
These fixes are probably more appropriate, and complete: http://sourceware.org/ml/libc-hacker/2005-02/msg00000.html

The patch is in the link.  I'll test it later to make sure it works with our current snapshot.
Comment 2 Mark Loeser (RETIRED) gentoo-dev 2005-03-01 17:47:11 UTC
Apparently the patch above in comment #1 does not work completely.  I'll try to work on this more later.
Comment 3 Mark Loeser (RETIRED) gentoo-dev 2005-03-02 15:43:08 UTC
Created attachment 52503 [details, diff]
GCC 4 compile fix

This should allow you to compile glibc with the newest snapshot of GCC4 in
Portage.  Please test to make sure I didn't horribly break anything.
Comment 4 Mark Loeser (RETIRED) gentoo-dev 2005-03-08 09:07:48 UTC
Since this is all fixes to glibc, could the summary be changed to reflect this?
Comment 5 Dan Boline 2005-03-08 09:20:35 UTC
Oh alright
Comment 6 Mark Loeser (RETIRED) gentoo-dev 2005-03-14 15:21:31 UTC
Just a comment to say that even with this patch, glibc compiles fine with gcc 3.3 and 3.4.
Comment 7 SpanKY gentoo-dev 2005-03-14 20:30:08 UTC
*** Bug 84605 has been marked as a duplicate of this bug. ***
Comment 8 Jeremy Huddleston (RETIRED) gentoo-dev 2005-03-15 04:46:11 UTC
I've added this patch to my localpatchset, and if all goes well, I'll add it in when -r1 is unmasked in the next few days.
Comment 9 Jeremy Huddleston (RETIRED) gentoo-dev 2005-03-15 12:20:24 UTC
Ok, it's in now.  Thanks for the help.
Comment 10 Mart Raudsepp gentoo-dev 2005-03-16 23:26:06 UTC
gcc-4 alphas beyond 20050130 still fail to build for me (not sure about 0130 now, just succeeded with it quite some time ago).

./xgcc -B./ -B/usr/i686-pc-linux-gnu/bin/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -L/var/tmp/portage/gcc-4.0.0_beta20050305/work/build/gcc/../ld -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I/var/tmp/portage/gcc-4.0.0_beta20050305/work/gcc-4.0-20050305/gcc -I/var/tmp/portage/gcc-4.0.0_beta20050305/work/gcc-4.0-20050305/gcc/. -I/var/tmp/portage/gcc-4.0.0_beta20050305/work/gcc-4.0-20050305/gcc/../include -I/var/tmp/portage/gcc-4.0.0_beta20050305/work/gcc-4.0-20050305/gcc/../libcpp/include  -fvisibility=hidden -DHIDE_EXPORTS -fexceptions -c /var/tmp/portage/gcc-4.0.0_beta20050305/work/gcc-4.0-20050305/gcc/unwind-dw2.c -o libgcc/./unwind-dw2.o
In file included from /var/tmp/portage/gcc-4.0.0_beta20050305/work/gcc-4.0-20050305/gcc/gthr-posix.h:43,
                 from ./gthr-default.h:1,
                 from /var/tmp/portage/gcc-4.0.0_beta20050305/work/gcc-4.0-20050305/gcc/gthr.h:114,
                 from /var/tmp/portage/gcc-4.0.0_beta20050305/work/gcc-4.0-20050305/gcc/unwind-dw2.c:42:
/usr/include/pthread.h:664: error: array type has incomplete element type
make[3]: *** [libgcc/./unwind-dw2.o] Error 1
make[3]: Leaving directory `/var/tmp/portage/gcc-4.0.0_beta20050305/work/build/gcc'
make[2]: *** [libgcc.a] Error 2
make[2]: Leaving directory `/var/tmp/portage/gcc-4.0.0_beta20050305/work/build/gcc'
make[1]: *** [stage1_build] Error 2
make[1]: Leaving directory `/var/tmp/portage/gcc-4.0.0_beta20050305/work/build/gcc'
make: *** [profiledbootstrap] Error 2

!!! ERROR: sys-devel/gcc-4.0.0_beta20050305 failed.
!!! Function gcc_do_make, Line 1171, Exitcode 2
!!! make failed with profiledbootstrap
!!! If you need support, post the topmost build error, NOT this status message.


Why is the patch applied as part of
5040_all_2.3.4-gcc4.patch,
which is excluded from the patchset if the compiler isn't gcc4, therefore making it totally useless in the first place?
[[ $(gcc-major-version) == "4" ]] || GLIBC_PATCH_EXCLUDE="${GLIBC_PATCH_EXCLUDE} 5040_all_2.3.4-gcc4.patch"

I compile glibc with 3.4.3 of course (not with 4.0.0alpha-20050130 that I do have installed in addition), therefore $(gcc-major-version) == "4" check should return 0, the second part of OR is evaluated and therefore the 5040_all_2.3.4-gcc4.patch excluded and the fix is inside that patch....
Comment 11 Martin Schlemmer (RETIRED) gentoo-dev 2005-03-16 23:30:39 UTC
You are looking at it wrong - that line means: if its not gcc-4, exclude the patch (or that is what should be happening with that logic).
Comment 12 Mart Raudsepp gentoo-dev 2005-03-16 23:36:55 UTC
That's exactly how I was looking at it. I am trying to install the gcc4 compiler, and logically I am trying to upgrade glibc and install gcc4 with the previous version of the compiler - 3.4.x.

The patch is excluded (as glibc is not being compiled with gcc-4, which I can't get before I succesfully install a fixed glibc), glibc isn't fixed, and I can't install gcc4 in the first place, for the patch to ever be included.

There should be no condition on the gcc version for that particular glibc patch, not talking about all the other file diffs inside the gcc4 specific patch.
Comment 13 Martin Schlemmer (RETIRED) gentoo-dev 2005-03-16 23:48:15 UTC
Ok, so the patch is needed for gcc-4.x to compile, and not to compile glibc with gcc-4.x ?  Sorry, did not read the whole thing, or worked with the bug.
Comment 14 Mart Raudsepp gentoo-dev 2005-03-17 00:04:20 UTC
It appears the background of this larger patch was to make glibc compile with gcc4, but one little part of this, namely:
- extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROW;
+ extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROW;
is necessary for gcc4 to build (with glibc), not glibc to build with gcc4.

Every gcc4 snapshot in portage beyond 20050130 has failed to compile on my NPTL-only/gcc-3.4.x system. Now I hand-edited /usr/include/pthread.h to change __env[1] to *__env and so far the gcc4 upgrade is doing good. Hasn't errored yet, and if the problem is there still it should have encountered it quite some minutes ago. I need gcc4 to work on things as a developer, not use the fortunately already installed older _snapshot_ of gcc4 to install the single-most important library on the system.

But I believe we all like upstream bugzillas, so the relevant bugzilla link:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20166

It talks about a workaround in gcc4 for the glibc problem, in the end is a fixinclude for glibc, as far I can decipher, does that little array to pointer patch.
Comment 15 Mark Loeser (RETIRED) gentoo-dev 2005-03-17 00:25:19 UTC
This patch was to fix all of the errors associated with glibc and gcc4.  Yes, the one header is needed to compile gcc.  I am not certain why it is only conditionally applied, to upgrade to gcc4, one would need that header patched in order to compile gcc.
Comment 16 Martin Schlemmer (RETIRED) gentoo-dev 2005-03-17 00:25:47 UTC
-----
- extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROW;
+ extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROW;
-----

Hmm, that is wrong.  Or in the context of the original anyhow - this should be closer:

-----
- extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROW;
+ extern int __sigsetjmp (struct __jmp_buf_tag *(__env + 1), int __savemask) __THROW;
-----
Comment 17 Martin Schlemmer (RETIRED) gentoo-dev 2005-03-17 00:27:58 UTC
Although it looks wonky in the first place.
Comment 18 Martin Schlemmer (RETIRED) gentoo-dev 2005-03-17 00:29:36 UTC
Urk, dont worry, im still sleeping.
Comment 20 SpanKY gentoo-dev 2005-03-18 15:52:25 UTC
*** Bug 85707 has been marked as a duplicate of this bug. ***
Comment 21 SpanKY gentoo-dev 2005-03-22 08:25:28 UTC
*** Bug 86248 has been marked as a duplicate of this bug. ***
Comment 22 Aaron Walker (RETIRED) gentoo-dev 2005-03-23 09:15:58 UTC
I'm still getting this here.
Comment 23 Martin Schlemmer (RETIRED) gentoo-dev 2005-03-23 21:42:57 UTC
Because its not been fixed.  Get a hold of eradicator and check why he applies that patch conditionally ...
Comment 24 Jeremy Huddleston (RETIRED) gentoo-dev 2005-03-24 00:52:19 UTC
I was applying it conditionally because I thought it was the cause of the segfault headaches... I was incorrect there, and I think we can remove the conditional in -r2 once az's patch gets cleaned up =)
Comment 25 Martin Schlemmer (RETIRED) gentoo-dev 2005-03-24 00:59:06 UTC
Apparently is not my patch either :/

  http://bugs.gentoo.org/show_bug.cgi?id=85555#c77

I added a simple test for both (idea from mike), so hopefully we will just get die messages, and not hosed systems from now on.
Comment 26 Mark Loeser (RETIRED) gentoo-dev 2005-04-02 23:56:35 UTC
*** Bug 87293 has been marked as a duplicate of this bug. ***
Comment 27 SpanKY gentoo-dev 2005-04-06 18:36:38 UTC
*** Bug 88219 has been marked as a duplicate of this bug. ***
Comment 28 Christian Parpart (RETIRED) gentoo-dev 2005-04-06 20:02:41 UTC
some words on bug-report duplication:

I did *not* honor this bug report here, because its topic is:

"glibc fails to compile with gcc-4.0"

that is, that glic failes to compile with gcc-4.0, I mean, it tells me, that I should have gcc-4 already installed and I am trying to compile glibc (that fails to compile with gcc-4.) I know, it's really early in the morning already here (4:56am), but this is really odd anyway.

So, the exact fix (as actually reported in my bug report) is the following extract from the attachment one of you made.

diff -ur glibc-2.3.4-orig/nptl/sysdeps/pthread/pthread.h glibc-2.3.4/nptl/sysdeps/pthread/pthread.h
--- glibc-2.3.4-orig/nptl/sysdeps/pthread/pthread.h	2005-03-02 17:50:28.000000000 -0500
+++ glibc-2.3.4/nptl/sysdeps/pthread/pthread.h	2005-03-02 16:58:54.000000000 -0500
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -661,7 +661,7 @@
 
 /* Function used in the macros.  */
 struct __jmp_buf_tag;
-extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROW;
+extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROW;
 
 
 /* Mutex handling.  */

Though, the topic shall be "gcc-4.0 fails to compile due glibc issues)" and noth the other way around.

Having a look at the other changes in the patch, I must say, that they rather look like code cleanups and little typo fixes (RESOLVE/RESOLVE_MAP) and are somewhat unrelated to the current issue (yet still not unimportant anyway).

g'n8,
Christian Parpart.
Comment 29 Mark Loeser (RETIRED) gentoo-dev 2005-04-07 10:48:31 UTC
Like I said, the one fix is needed to get gcc4 to compile.  The other patches don't really matter at this point since there are other breakages in glibc that are only fixed in the latest snapshots.  With the newer snapshots of gcc4, you'll need a newer snapshot of glibc if you want to recompile glibc.  I'm running the glibc snapshot from 4/4 without problems.  One patch is needed for binutils to support the AS_NEEDED stuff the newer glibc's use.
Comment 30 SpanKY gentoo-dev 2005-04-08 10:00:13 UTC
*** Bug 88368 has been marked as a duplicate of this bug. ***
Comment 31 Jeremy Huddleston (RETIRED) gentoo-dev 2005-04-09 18:23:06 UTC
it's applied now in -r1 glibc
Comment 32 SpanKY gentoo-dev 2005-04-22 05:30:14 UTC
*** Bug 89998 has been marked as a duplicate of this bug. ***
Comment 33 SpanKY gentoo-dev 2005-04-22 21:47:37 UTC
*** Bug 90029 has been marked as a duplicate of this bug. ***
Comment 34 SpanKY gentoo-dev 2005-04-24 09:47:56 UTC
*** Bug 90212 has been marked as a duplicate of this bug. ***
Comment 35 Joël 2005-04-27 07:16:48 UTC
I've tried to compile gcc 4.0.0 (after re-emerging glibc 2.3.4.20041102-r1), and I got the error mentioned in comment #10.

So, which -r1 version does comment #31 refer to ?
Comment 36 Aaron Walker (RETIRED) gentoo-dev 2005-04-27 07:32:21 UTC
Jo
Comment 37 Aaron Walker (RETIRED) gentoo-dev 2005-04-27 07:32:21 UTC
Joël, I assumed he meant the latest -r1, which is 2.3.4.20050125-r1.  My gcc-4 worked after I rebuilt it.
Comment 38 Joël 2005-04-28 00:18:58 UTC
It worked, thanks Aaron !
Comment 39 SpanKY gentoo-dev 2005-05-31 05:18:04 UTC
*** Bug 94610 has been marked as a duplicate of this bug. ***
Comment 40 Mark Loeser (RETIRED) gentoo-dev 2005-09-03 20:37:28 UTC
*** Bug 88395 has been marked as a duplicate of this bug. ***