| Summary: | sys-devel/gcc-4.6.4 - libiberty/fibheap.c:220:30: error: ‘LONG_MIN’ undeclared | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Martin von Gagern <Martin.vGagern> |
| Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
| Status: | RESOLVED OBSOLETE | ||
| Severity: | normal | CC: | admin, eike, grubba, itumaykin+gentoo, mkaama, phobosk, sh |
| Priority: | Normal | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Attachments: |
build logs (bzip2-compressed tar)
libiberty/config.log emerge --info ebuild logs for gcc 4.9.3 gcc build failed with 'Bootstrap comparison failure!' |
||
Created attachment 431110 [details]
libiberty/config.log
I had a look at the preprocessor output, and found it to include these files:
./config.h
/usr/include/bits/stdio2.h
/usr/include/bits/stdio.h
/usr/include/bits/stdio_lim.h
/usr/include/bits/sys_errlist.h
/usr/include/bits/types.h
/usr/include/bits/typesizes.h
/usr/include/bits/wordsize.h
/usr/include/features.h
/usr/include/_G_config.h
/usr/include/gnu/stubs-64.h
/usr/include/gnu/stubs.h
/usr/include/libio.h
/usr/include/stdc-predef.h
/usr/include/stdio.h
/usr/include/sys/cdefs.h
/usr/include/wchar.h
/var/tmp/portage/sys-devel/gcc-4.6.4/work/build/libiberty//
/var/tmp/portage/sys-devel/gcc-4.6.4/work/build/./prev-gcc/include/stdarg.h
/var/tmp/portage/sys-devel/gcc-4.6.4/work/build/./prev-gcc/include/stddef.h
/var/tmp/portage/sys-devel/gcc-4.6.4/work/gcc-4.6.4/libiberty/fibheap.c
/var/tmp/portage/sys-devel/gcc-4.6.4/work/gcc-4.6.4/libiberty/../include/ansidecl.h
/var/tmp/portage/sys-devel/gcc-4.6.4/work/gcc-4.6.4/libiberty/../include/fibheap.h
/var/tmp/portage/sys-devel/gcc-4.6.4/work/gcc-4.6.4/libiberty/../include/libiberty.h
Not limits.h for LONG_MIN, nor stdlib.h for free or abort, nor string.h for memset. Looking at the header of fibheap.c:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
But /var/tmp/portage/sys-devel/gcc-4.6.4/work/build/libiberty/config.h only defines HAVE_SYS_WAIT_H, all the other HAVE_*_H are left undefined. So apparently configure messed up somehow.
configure:4487: checking for stdlib.h
configure:4487: /var/tmp/portage/sys-devel/gcc-4.6.4/work/build/./prev-gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-4.6.4/work/build/./prev-gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include -E conftest.c
In file included from /usr/include/stdlib.h:24:0,
from conftest.c:10:
/usr/include/features.h:331:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
configure:4487: $? = 0
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| /* end confdefs.h. */
| #include <stdlib.h>
configure:4487: result: no
I guess the preprocessor warning may be confusing configure here. So perhaps somehow this is a consequence of 10_all_default-fortify-source.patch? But why is it triggered? The gcc invocation does include -O2:
/var/tmp/portage/sys-devel/gcc-4.6.4/work/build/./prev-gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-4.6.4/work/build/./prev-gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include -c -DHAVE_CONFIG_H -m64 -march=amdfam10 -O2 -ggdb -pipe -gtoggle -I. -I/var/tmp/portage/sys-devel/gcc-4.6.4/work/gcc-4.6.4/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic -fpic /var/tmp/portage/sys-devel/gcc-4.6.4/work/gcc-4.6.4/libiberty/fibheap.c -o pic/fibheap.o
Perhaps xgcc is lacking support for the __OPTIMIZE__ builtin preprocessor macro?
> Perhaps xgcc is lacking support for the __OPTIMIZE__ builtin preprocessor macro?
Been looking at the wrong command: this isn't about fibheap.c being compiled by make, but about conftest.c being compiled by gcc. So the question is, why does conftest.c compile with the _FORTIFY_SOURCE macro enabled if the patch claims that macro to only affect -O2 and higher.
Running the xgcc command line with all -D options and -E -dM, I can verify that it defines _FORTIFY_SOURCE but does not define __OPTIMIZE__.
Created attachment 431112 [details]
emerge --info
This appears to be somewhat related to bug 433333. It's about a Fedorea prefix, and one comment there states > Fedora/RedHat injected some fugly crap in their /usr/include/features.h. Looks like that crap now turned mainstream. I still don't understand why the flag gets set in the xgcc run, though, so I'm not sure I'd blame that #warning. I had a closer look at the patches. The 10_all_default-fortify-source.patch from gcc 4.6.4 reads
builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
the one from gcc 5.3.0 however has
cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)");
So that explains why it's only the old gcc which fails to configure. Looking for the source of said patch I stumbled upon this:
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/4.6.4/gentoo/10_all_default-fortify-source.patch?hideattic=0&revision=1.2&view=markup
Apparently vapier removed that patch from the patchset on 2016-01-13. But the gcc-4.6.4-patches-1.3.tar.bz2 on my system still has the file, dated 2015-05-27. Perhaps the removal of the patch didn't make it to the ebuild level?
As a workaround, I tried
EPATCH_USER_EXCLUDE='*10_all_default-fortify-source*' \
emerge -1 --nodeps =sys-devel/gcc-4.6.4
which failed at first complaining about msgfmt issues. But with the patch from bug 372377 comment 7 things did work for me.
The same problem here, trying to emerge sys-devel/gcc-4.9.3 with incumbent gcc-4.6.3 . Initially, the error was the same as bug 498346, filenames.h:85:6: error: unknown type name ‘size_t’ . After adding "-O2" it became /var/tmp/portage/sys-devel/gcc-4.9.3/work/gcc-4.9.3/libiberty/fibheap.c:220:30: error: ‘LONG_MIN’ undeclared (first use in this function) . Adding -O2 does not resolve the problem. Removing the "nls" keyword does not resolve the problem. Created attachment 432158 [details]
ebuild logs for gcc 4.9.3
Changed the environment to
CFLAGS=-O2
CFLAGS_FOR_BUILD=-O2
/etc/portage/package.use:
=sys-devel/gcc-4.9.3 -fortran -nls -multislot CPPFLAGS="-O2" CFLAGS="-O2"
(In reply to Martin von Gagern from comment #6) > As a workaround, I tried > > EPATCH_USER_EXCLUDE='*10_all_default-fortify-source*' \ > emerge -1 --nodeps =sys-devel/gcc-4.6.4 > > which failed at first complaining about msgfmt issues. But with the patch > from bug 372377 comment 7 things did work for me. I can confirm that this workaround fixes the build on my machine. Thanks! I had the same problem remerging sys-devel/gcc-4.6.4 I confirm that building with: EPATCH_USER_EXCLUDE='*10_all_default-fortify-source*' USE="-nls" emerge --nodep\ s --verbose =sys-devel/gcc-4.6.4 works for me on amd64: # USE="-nls" emerge -pqv =sys-devel/gcc-4.6.4 [ebuild R ] sys-devel/gcc-4.6.4 USE="cxx doc fortran (multilib) nptl objc objc++ openmp (-altivec) (-awt) -debug (-fixed-point) -gcj (-hardened) (-libssp) -mudflap -nls -objc-gc -regression-test -vanilla" (In reply to Jocelyn Mayer from comment #10) > I had the same problem remerging sys-devel/gcc-4.6.4 > I confirm that building with: > EPATCH_USER_EXCLUDE='*10_all_default-fortify-source*' USE="-nls" emerge > --nodep\ > s --verbose =sys-devel/gcc-4.6.4 > works for me on amd64: > # USE="-nls" emerge -pqv =sys-devel/gcc-4.6.4 > [ebuild R ] sys-devel/gcc-4.6.4 USE="cxx doc fortran (multilib) nptl > objc objc++ openmp (-altivec) (-awt) -debug (-fixed-point) -gcj (-hardened) > (-libssp) -mudflap -nls -objc-gc -regression-test -vanilla" This workaround does't work for me. I got following error: Comparing stages 2 and 3 warning: gcc/cc1plus-checksum.o differs warning: gcc/cc1-checksum.o differs Bootstrap comparison failure! Created attachment 470828 [details]
gcc build failed with 'Bootstrap comparison failure!'
*** Bug 614834 has been marked as a duplicate of this bug. *** For me, these two builds end up with the same error (and I cant rebuild gcc-4.6 with @preserved-rebuild either):
[ebuild NS ] sys-devel/binutils-2.26.1:2.26.1::gentoo [2.25.1-r1:2.25.1::gentoo] USE="cxx nls -multitarget -static-libs {-test} -vanilla" 0 KiB
[ebuild NS ] sys-devel/gcc-5.4.0-r3:5.4.0::gentoo [4.6.3:4.6.4::gentoo] USE="cxx fortran (multilib) nls nptl openmp sanitize vtv (-altivec) (-awt) -cilk -debug -doc (-fixed-point) -gcj -go -g
Error is:
/tmp/portage/sys-devel/binutils-2.26.1/work/binutils-2.26.1/libiberty/fibheap.c: In function ‘fibheap_replace_key_data’:
/tmp/portage/sys-devel/binutils-2.26.1/work/binutils-2.26.1/libiberty/fibheap.c:220:30: error: ‘LONG_MIN’ undeclared (first use in this function)
/tmp/portage/sys-devel/binutils-2.26.1/work/binutils-2.26.1/libiberty/fibheap.c:220:30: note: each undeclared identifier is reported only once for each function it appears in
/tmp/portage/sys-devel/binutils-2.26.1/work/binutils-2.26.1/libiberty/fibheap.c: In function ‘fibheap_delete_node’:
/tmp/portage/sys-devel/binutils-2.26.1/work/binutils-2.26.1/libiberty/fibheap.c:261:36: error: ‘LONG_MIN’ undeclared (first use in this function)
gcc-4.6.3 is the only compiler on this machine. On another two PCs, I am not experiencing these compilation issues (they already have gcc-5.4.0, and 4.9.3).
(In reply to Martin von Gagern from comment #6) > As a workaround, I tried > > EPATCH_USER_EXCLUDE='*10_all_default-fortify-source*' \ > emerge -1 --nodeps =sys-devel/gcc-4.6.4 EPATCH_USER_EXCLUDE workaround helps. Thank you. Same Problem here x86_64-pc-linux-gnu-gcc -c -DHAVE_CONFIG_H -march=core2 -mtune=generic -O2 -pipe -I. -I/mnt/data/tmp/portage/portage/sys-devel/binutils-2.28.1/work/binutils-2.28.1/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic -D_GNU_SOURCE /mnt/data/tmp/portage/portage/sys-devel/binutils-2.28.1/work/binutils-2.28.1/libiberty/fdmatch.c -o fdmatch.o /mnt/data/tmp/portage/portage/sys-devel/binutils-2.28.1/work/binutils-2.28.1/libiberty/fibheap.c: In function 'fibheap_replace_key_data': /mnt/data/tmp/portage/portage/sys-devel/binutils-2.28.1/work/binutils-2.28.1/libiberty/fibheap.c:220:30: error: 'LONG_MIN' undeclared (first use in this function) /mnt/data/tmp/portage/portage/sys-devel/binutils-2.28.1/work/binutils-2.28.1/libiberty/fibheap.c:220:30: note: each undeclared identifier is reported only once for each function it appears in /mnt/data/tmp/portage/portage/sys-devel/binutils-2.28.1/work/binutils-2.28.1/libiberty/fibheap.c: In function 'fibheap_delete_node': /mnt/data/tmp/portage/portage/sys-devel/binutils-2.28.1/work/binutils-2.28.1/libiberty/fibheap.c:261:36: error: 'LONG_MIN' undeclared (first use in this function) make[2]: *** [fibheap.o] Error 1 Command line was: # EPATCH_USER_EXCLUDE='*fortify-source*' emerge -av sys-devel/binutils Is there any known method to get the compiler and binutils to the lastest version without reinstalling the whole system? This is a server systen abd I *really* cannot take this down for a re install just for upgrading gcc. All this weirdness involves gcc-4.6, which is way long masked and ages old. |
Created attachment 431098 [details] build logs (bzip2-compressed tar) I've got some trouble recompiling gcc 4.6.4: $S/libiberty/fibheap.c: In function ‘fibheap_union’: $S/libiberty/fibheap.c:151:7: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration] $S/libiberty/fibheap.c:151:7: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default] $S/libiberty/fibheap.c:156:7: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default] $S/libiberty/fibheap.c:172:3: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default] $S/libiberty/fibheap.c: In function ‘fibheap_extract_min’: $S/libiberty/fibheap.c:190:7: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default] $S/libiberty/fibheap.c: In function ‘fibheap_replace_key_data’: $S/libiberty/fibheap.c:220:30: error: ‘LONG_MIN’ undeclared (first use in this function) $S/libiberty/fibheap.c:220:30: note: each undeclared identifier is reported only once for each function it appears in $S/libiberty/fibheap.c: In function ‘fibheap_delete_node’: $S/libiberty/fibheap.c:261:36: error: ‘LONG_MIN’ undeclared (first use in this function) $S/libiberty/fibheap.c:265:7: warning: implicit declaration of function ‘abort’ [-Wimplicit-function-declaration] $S/libiberty/fibheap.c:265:7: warning: incompatible implicit declaration of built-in function ‘abort’ [enabled by default] $S/libiberty/fibheap.c: In function ‘fibheap_delete’: $S/libiberty/fibheap.c:277:5: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default] $S/libiberty/fibheap.c: In function ‘fibheap_consolidate’: $S/libiberty/fibheap.c:368:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration] $S/libiberty/fibheap.c:368:3: warning: incompatible implicit declaration of built-in function ‘memset’ [enabled by default] Makefile:646: recipe for target 'fibheap.o' failed make[3]: *** [fibheap.o] Error 1 make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-4.6.4/work/build/libiberty' Makefile:10496: recipe for target 'all-stage2-libiberty' failed make[2]: *** [all-stage2-libiberty] Error 2 make[2]: Leaving directory '/var/tmp/portage/sys-devel/gcc-4.6.4/work/build' Makefile:20779: recipe for target 'stage2-bubble' failed make[1]: *** [stage2-bubble] Error 2 make[1]: Leaving directory '/var/tmp/portage/sys-devel/gcc-4.6.4/work/build' Makefile:20977: recipe for target 'bootstrap-lean' failed make: *** [bootstrap-lean] Error 2 This was with MAKEOPTS=-j1, to make the build log clearer.