[bootstrap] Tentative fix for PR 54281

Magnus Fromreide magfr@lysator.liu.se
Thu Aug 16 17:50:00 GMT 2012


On Thu, Aug 16, 2012 at 07:55:51AM -0400, Diego Novillo wrote:
> Richi, this implements your idea for fixing PR 54281.  I don't
> have an old enough compiler.  Could you please test it in your
> system?
> 
> I debated whether to remove the GENERATOR_FILE predicate from the
> inclusion (some files include gmp.h unconditionally).  I think it
> could be removed, but only a minority of files build with
> GENERATOR_FILE set, so it didn't seem harmful.
> 
> OK if tests pass?

This patch breaks building with gmp, cloog and isl in subdirectories of the
source tree.


echo timestamp > s-options
gawk -f ../../trunk/gcc/opt-functions.awk -f ../../trunk/gcc/opt-read.awk \
       -f ../../trunk/gcc/opth-gen.awk \
       < optionlist > tmp-options.h
/bin/sh ../../trunk/gcc/../move-if-change tmp-options.h options.h
echo timestamp > s-options-h
TARGET_CPU_DEFAULT="" \
HEADERS="auto-host.h ansidecl.h" DEFINES="" \
/bin/sh ../../trunk/gcc/mkconfig.sh bconfig.h
g++ -c   -g -DIN_GCC   -fno-exceptions -fno-rtti -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../trunk/gcc -I../../trunk/gcc/build -I../../trunk/gcc/../include -I../../trunk/gcc/../libcpp/include -I/home/magfr/src/gcc/build/./gmp -I/home/magfr/src/gcc/trunk/gmp -I/home/magfr/src/gcc/build/./mpfr -I/home/magfr/src/gcc/trunk/mpfr -I/home/magfr/src/gcc/trunk/mpc/src  -I../../trunk/gcc/../libdecnumber -I../../trunk/gcc/../libdecnumber/bid -I../libdecnumber -DCLOOG_INT_GMP -I/home/magfr/src/gcc/build/./cloog/include -I/home/magfr/src/gcc/trunk/cloog/include -I../trunk/cloog/include  -I/home/magfr/src/gcc/build/./isl/include -I/home/magfr/src/gcc/trunk/isl/include  \
        -o build/genconstants.o ../../trunk/gcc/genconstants.c
In file included from /usr/include/sys/resource.h:25:0,
                 from /usr/include/sys/wait.h:32,
                 from ../../trunk/gcc/system.h:351,
                 from ../../trunk/gcc/genconstants.c:29:
/usr/include/bits/resource.h:133:18: error: declaration does not declare anything [-fpermissive]
In file included from ../../trunk/gcc/genconstants.c:29:0:
../../trunk/gcc/system.h:443:23: error: declaration of C function `void* sbrk(int)' conflicts with
In file included from ../../trunk/gcc/system.h:253:0,
                 from ../../trunk/gcc/genconstants.c:29:
/usr/include/unistd.h:1067:14: error: previous declaration `void* sbrk(intptr_t)' here
In file included from ../../trunk/gcc/genconstants.c:29:0:
../../trunk/gcc/system.h:447:48: error: new declaration `char* strstr(const char*, const char*)'
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/cstring:44:0,
                 from ../../trunk/gcc/system.h:207,
                 from ../../trunk/gcc/genconstants.c:29:
/usr/include/string.h:323:22: error: ambiguates old declaration `const char* strstr(const char*, const char*)'
In file included from ../../trunk/gcc/genconstants.c:29:0:
../../trunk/gcc/system.h:499:34: error: declaration of C function `const char* strsignal(int)' conflicts with
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/cstring:44:0,
                 from ../../trunk/gcc/system.h:207,
                 from ../../trunk/gcc/genconstants.c:29:
/usr/include/string.h:566:14: error: previous declaration `char* strsignal(int)' here
In file included from ../../trunk/gcc/system.h:639:0,
                 from ../../trunk/gcc/genconstants.c:29:
../../trunk/gcc/../include/libiberty.h:110:36: error: new declaration `char* basename(const char*)'
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/cstring:44:0,
                 from ../../trunk/gcc/system.h:207,
                 from ../../trunk/gcc/genconstants.c:29:
/usr/include/string.h:603:28: error: ambiguates old declaration `const char* basename(const char*)'
make[3]: *** [build/genconstants.o] Error 1
make[3]: Leaving directory `/home/magfr/src/gcc/build/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/magfr/src/gcc/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/magfr/src/gcc/build'
make: *** [all] Error 2


The problem seems to be that during configure time the test scripts include
system.h, but it fails to add the gmp include directory to the compiler flags
so the checks for sbrk, strstr and so on fails with


configure:10294: checking whether sbrk is declared
configure:10317: gcc -c -g -I../../trunk/gcc -I../../trunk/gcc/../include  conftest.c >&5
In file included from conftest.c:125:0:
../../trunk/gcc/system.h:1041:17: fatal error: gmp.h: No such file or directory
compilation terminated.
configure:10317: $? = 1


Reverting this patch makes the compiler build.

/MF



More information about the Gcc-patches mailing list