Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 671270

Summary: sys-devel/gcc-4.5.4 and sys-devel/gcc-4.7.4-r1 fail to build with error: field ‘uc’ has incomplete type
Product: Gentoo Linux Reporter: Cyp <cyp561>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED FIXED    
Severity: normal CC: slyfox
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: 95_all_ucontext-to-ucontext_t.patch.out

Description Cyp 2018-11-16 13:48:41 UTC
Encountered during emerge @preserved-rebuild.

sys-devel/gcc-4.5.4 and sys-devel/gcc-4.7.4-r1 fail to build with error: field ‘uc’ has incomplete type

sys-devel/gcc-4.5.4:
> In file included from /var/tmp/portage/sys-devel/gcc-4.5.4/work/gcc-4.5.4/libgcc/../gcc/unwind-dw2.c:334:0:
> /var/tmp/portage/sys-devel/gcc-4.5.4/work/gcc-4.5.4/libgcc/../gcc/config/i386/linux-unwind.h: In function ‘x86_fallback_frame_state’:
> /var/tmp/portage/sys-devel/gcc-4.5.4/work/gcc-4.5.4/libgcc/../gcc/config/i386/linux-unwind.h:139:18: error: field ‘uc’ has incomplete type
> make[5]: *** [/var/tmp/portage/sys-devel/gcc-4.5.4/work/gcc-4.5.4/libgcc/shared-object.mk:12: unwind-dw2.o] Error 1

sys-devel/gcc-4.7.4-r1:
> In file included from /var/tmp/portage/sys-devel/gcc-4.7.4-r1/work/gcc-4.7.4/libgcc/unwind-dw2.c:376:0:
> ./md-unwind-support.h: In function ‘x86_fallback_frame_state’:
> ./md-unwind-support.h:145:18: error: field ‘uc’ has incomplete type

May be related to bug 640368.

Not sure how high the priority of buildability of hard-masked ancient gcc versions is. I tend to keep them around just in case I encounter a gcc bug and want to see if happens in old versions.
Comment 1 Matt Turner gentoo-dev 2018-11-16 19:33:43 UTC
It's not typically possible to build very old gcc versions with the latest gcc. Try building gcc-4.7 with the next newer version you have, etc.
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2018-11-17 17:58:10 UTC
Does gcc-4.5.4-r1 and gcc-4.7.4-r2 work for you?
Comment 3 Cyp 2018-11-18 12:22:52 UTC
Settings gcc-4.7.4 as the system compiler, compiling gcc-4.7.4-r1, I still get:
> In file included from /var/tmp/portage/sys-devel/gcc-4.7.4-r1/work/gcc-4.7.4/libgcc/unwind-dw2.c:376:0:
> ./md-unwind-support.h: In function ‘x86_fallback_frame_state’:
> ./md-unwind-support.h:145:18: error: field ‘uc’ has incomplete type
> make[5]: *** [/var/tmp/portage/sys-devel/gcc-4.7.4-r1/work/gcc-4.7.4/libgcc/shared-object.mk:14: unwind-dw2.o] Error 1
> make[5]: *** Waiting for unfinished jobs....

Trying gcc-4.7.4-r2 (with or without 4.7.4 as the system compiler), I get this instead: (not completely sure, but I think it takes longer before giving an error than -r1)
> mv -f $depbase.Tpo $depbase.Plo
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libjava/prims.cc: In function ‘void _Jv_catch_fpe(int, siginfo_t*, void*)’:
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libjava/prims.cc:192:3: error: invalid use of incomplete type ‘struct _Jv_catch_fpe(int, siginfo_t*, void*)::ucontext’
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libjava/prims.cc:192:3: error: forward declaration of ‘struct _Jv_catch_fpe(int, siginfo_t*, void*)::ucontext’
> mv -f .deps/cshift0_i2.Tpo .deps/cshift0_i2.Plo

Haven't tried gcc-4.5.4-r1.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2018-11-19 22:51:20 UTC
Can you post full build.log? I guess you have gcj and awt enabled.
Comment 5 Larry the Git Cow gentoo-dev 2018-11-19 23:40:19 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=750c85768c0bbbd29e6db6a0d173f5b55e5a2edb

commit 750c85768c0bbbd29e6db6a0d173f5b55e5a2edb
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-11-19 23:39:46 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-11-19 23:39:46 +0000

    4.3.6: backport libjava-ucontext.patch: bug #671270
    
    Reported-by: Cyp
    Bug: https://bugs.gentoo.org/671270
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 4.3.6/gentoo/93_all_libjava-ucontext.patch | 47 ++++++++++++++++++++++++++++++
 4.3.6/gentoo/README.history                |  3 ++
 2 files changed, 50 insertions(+)

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=6d6bc8d2b00e049b999e9646b4094853776f5094

commit 6d6bc8d2b00e049b999e9646b4094853776f5094
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-11-19 23:39:33 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-11-19 23:39:33 +0000

    4.4.7: backport libjava-ucontext.patch: bug #671270
    
    Reported-by: Cyp
    Bug: https://bugs.gentoo.org/671270
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 4.4.7/gentoo/98_all_libjava-ucontext.patch | 47 ++++++++++++++++++++++++++++++
 4.4.7/gentoo/README.history                |  3 ++
 2 files changed, 50 insertions(+)

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=daa311067ebdc86178b5a7d3f413c369b46e7a7e

commit daa311067ebdc86178b5a7d3f413c369b46e7a7e
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-11-19 23:39:19 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-11-19 23:39:19 +0000

    4.5.4: backport libjava-ucontext.patch: bug #671270
    
    Reported-by: Cyp
    Bug: https://bugs.gentoo.org/671270
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 4.5.4/gentoo/101_all_libjava-ucontext.patch | 47 +++++++++++++++++++++++++++++
 4.5.4/gentoo/README.history                 |  3 ++
 2 files changed, 50 insertions(+)

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=637f374a31cd971c1afff480162fc4ea9b675189

commit 637f374a31cd971c1afff480162fc4ea9b675189
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-11-19 23:39:00 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-11-19 23:39:00 +0000

    4.6.4: backport libjava-ucontext.patch: bug #671270
    
    Reported-by: Cyp
    Bug: https://bugs.gentoo.org/671270
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 4.6.4/gentoo/95_all_libjava-ucontext.patch | 62 ++++++++++++++++++++++++++++++
 4.6.4/gentoo/README.history                |  3 ++
 2 files changed, 65 insertions(+)

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=291c14f52fb8ea6e78852295df2a3344ed111966

commit 291c14f52fb8ea6e78852295df2a3344ed111966
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-11-19 23:38:44 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-11-19 23:38:44 +0000

    4.7.4: backport libjava-ucontext.patch: bug #671270
    
    Reported-by: Cyp
    Bug: https://bugs.gentoo.org/671270
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 4.7.4/gentoo/96_all_libjava-ucontext.patch | 62 ++++++++++++++++++++++++++++++
 4.7.4/gentoo/README.history                |  3 ++
 2 files changed, 65 insertions(+)

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=31dd52a2c44dd23b963c97a62bfb413d6e640e2c

commit 31dd52a2c44dd23b963c97a62bfb413d6e640e2c
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-11-19 23:37:58 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-11-19 23:37:58 +0000

    4.8.5: backport libjava-ucontext.patch: bug #671270
    
    Reported-by: Cyp
    Bug: https://bugs.gentoo.org/671270
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 4.8.5/gentoo/97_all_libjava-ucontext.patch | 62 ++++++++++++++++++++++++++++++
 4.8.5/gentoo/README.history                |  1 +
 2 files changed, 63 insertions(+)
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2018-11-19 23:41:50 UTC
As a workaround you can use USE=-gcj flag or drop a path to /etc/portage/patches/sys-devel/gcc:4.7.4/ until new gcc patchset is out.
Comment 7 Cyp 2018-11-20 13:13:01 UTC
Created attachment 555794 [details]
95_all_ucontext-to-ucontext_t.patch.out

First patch attempt ignored since wget saved the patch with the '.patch?id=31dd52a2c44dd23b963c97a62bfb413d6e640e2c' extension instead of the '.patch' extension.

Second attempt (after renaming to *.patch), see attached.

Not sure if this is useful:
> # grep -r 'struct ucontext' /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/gcc/ChangeLog-2005:      'struct ucontext'.
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/gcc/testsuite/gcc.target/sparc/sparc-getcontext-1.c:typedef struct ucontext ucontext_t;
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/gcc/testsuite/gcc.target/sparc/sparc-getcontext-1.c:struct ucontext {
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libgcc/config/mips/linux-unwind.h: * struct ucontext from sys/ucontext.h so this private copy is used.  */
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libgcc/config/s390/linux-unwind.h:      struct ucontext_
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libgcc/config/s390/linux-unwind.h:       struct ucontext_ *uc_link;
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libgcc/config/sh/linux-unwind.h: struct ucontext uc;
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libjava/include/i386-signal.h:  struct ucontext *_uc = (struct ucontext *)_p;                            \
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libjava/include/sh-signal.h: * struct ucontext from sys/ucontext.h so this private copy is used.  */
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libjava/include/x86_64-signal.h:  struct ucontext *_uc = (struct ucontext *)_p;                          \
> /var/tmp/portage/sys-devel/gcc-4.7.4-r2/work/gcc-4.7.4/libjava/include/s390-signal.h:    struct ucontext *uc_link;                                           \

Huh? Leaving auto-detect instead of selecting text/plain for the attachment gives this error:
The content type chemical/x-gulp is invalid. Valid types must be of the form foo/bar where foo is one of application, audio, image, message, model, multipart, text, video and bar must not contain any special characters (such as "=", "?", ...).
Comment 8 Cyp 2018-11-20 13:55:24 UTC
Managed to build sys-devel/gcc-4.5.4-r1 with /etc/portage/patches/sys-devel/gcc:4.5.4/101_all_libjava-ucontext.patch, thanks.
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2019-06-22 08:06:03 UTC
gcc-4.5.4-r2 and 4.7.4-r3 are in tree and should contain the fix.