Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 580414 - sys-devel/gcc-4.6.4 - libiberty/fibheap.c:220:30: error: ‘LONG_MIN’ undeclared
Summary: sys-devel/gcc-4.6.4 - libiberty/fibheap.c:220:30: error: ‘LONG_MIN’ undeclared
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 614834 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-04-18 11:08 UTC by Martin von Gagern
Modified: 2017-10-03 22:28 UTC (History)
7 users (show)

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


Attachments
build logs (bzip2-compressed tar) (gcc-build-logs.tar.bz2,235.61 KB, application/octet-stream)
2016-04-18 11:08 UTC, Martin von Gagern
Details
libiberty/config.log (config.log,205.89 KB, text/plain)
2016-04-18 11:35 UTC, Martin von Gagern
Details
emerge --info (sys-devel:gcc-4.6.4.emerge--info,9.82 KB, text/plain)
2016-04-18 11:51 UTC, Martin von Gagern
Details
ebuild logs for gcc 4.9.3 (gcc-build-logs.tar.bz2,38.91 KB, application/octet-stream)
2016-04-26 17:26 UTC, mkaama
Details
gcc build failed with 'Bootstrap comparison failure!' (gcc-build-logs.tar.bz2,350.44 KB, application/x-bzip)
2017-04-25 02:17 UTC, blkf2016
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2016-04-18 11:08:11 UTC
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.
Comment 1 Martin von Gagern 2016-04-18 11:35:32 UTC
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?
Comment 2 Martin von Gagern 2016-04-18 11:50:55 UTC
> 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__.
Comment 3 Martin von Gagern 2016-04-18 11:51:30 UTC
Created attachment 431112 [details]
emerge --info
Comment 4 Martin von Gagern 2016-04-23 18:35:01 UTC
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.
Comment 5 Martin von Gagern 2016-04-24 08:10:21 UTC
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?
Comment 6 Martin von Gagern 2016-04-24 20:25:42 UTC
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.
Comment 7 mkaama 2016-04-26 17:18:38 UTC
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.
Comment 8 mkaama 2016-04-26 17:26:40 UTC
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"
Comment 9 Andreas Schäfer 2016-05-24 06:53:30 UTC
(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!
Comment 10 Jocelyn Mayer 2017-03-18 10:15:23 UTC
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"
Comment 11 blkf2016 2017-04-25 02:14:53 UTC
(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!
Comment 12 blkf2016 2017-04-25 02:17:09 UTC
Created attachment 470828 [details]
gcc build failed with 'Bootstrap comparison failure!'
Comment 13 Coacher 2017-04-30 15:08:47 UTC
*** Bug 614834 has been marked as a duplicate of this bug. ***
Comment 14 Daniel Rozsnyo 2017-05-21 23:10:39 UTC
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).
Comment 15 Coacher 2017-05-23 08:06:58 UTC
(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.
Comment 16 David Schueler 2017-09-04 10:35:13 UTC
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.
Comment 17 Andreas K. Hüttel archtester gentoo-dev 2017-10-03 22:28:39 UTC
All this weirdness involves gcc-4.6, which is way long masked and ages old.