https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69559

            Bug ID: 69559
           Summary: incompatible system library/header other than the one
                    in sysroot is used to build intermediate binaries in
                    gcc bootstrap
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amker at gcc dot gnu.org
  Target Milestone: ---

I ran into below error message at stage2 of bootstrap GCC:

/work/obj/gcc-bootstrap/./prev-gcc/xg++
-B/work/obj/gcc-bootstrap/./prev-gcc/ -B//aarch64-none-linux-gnu/bin/
-nostdinc++
-B/work/obj/gcc-bootstrap/prev-aarch64-none-linux-gnu/libstdc++-v3/src/.libs
-B/work/obj/gcc-bootstrap/prev-aarch64-none-linux-gnu/libstdc++-v3/libsupc++/.libs

-I/work/obj/gcc-bootstrap/prev-aarch64-none-linux-gnu/libstdc++-v3/include/aarch64-none-linux-gnu
 -I/work/obj/gcc-bootstrap/prev-aarch64-none-linux-gnu/libstdc++-v3/include
 -I/src/gcc/libstdc++-v3/libsupc++
-L/work/obj/gcc-bootstrap/prev-aarch64-none-linux-gnu/libstdc++-v3/src/.libs
-L/work/obj/gcc-bootstrap/prev-aarch64-none-linux-gnu/libstdc++-v3/libsupc++/.libs
-c   -g -O2 -gtoggle -DIN_GCC     -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings
-fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE -fno-PIE -I. -Ibuild
-I/src/gcc/gcc -I/src/gcc/gcc/build -I/src/gcc/gcc/../include
-I/src/gcc/gcc/../libcpp/include  \
        -o build/genautomata.o /src/gcc/gcc/genautomata.c
In file included from /src/gcc/gcc/genautomata.c:116:0:
/work/obj/gcc-bootstrap/prev-aarch64-none-linux-gnu/libstdc++-v3/include/math.h:65:12:
error: ‘constexpr bool std::isinf(double)’ conflicts with a previous
declaration
 using std::isinf;
            ^~~~~

In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from /src/gcc/gcc/system.h:46,
                 from /src/gcc/gcc/genautomata.c:108:
/usr/include/aarch64-linux-gnu/bits/mathcalls.h:201:1: note: previous
declaration ‘int isinf(double)’
 __MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
 ^

I kind of understand what the problem is based on below facts:
1) I bootstrap gcc against new glibc;
2) I configure gcc with "--with-build-sysroot". According to GCC
document, this only affects how target libraries are built.
3) binary executables are built in GCC for internal use purpose. These
binaries are used to generate internal files during building gcc, and
I guess they are not considered as target library. So system C
libraries/headers are used.
4) at stage2 of gcc bootstrap, these binaries are compiled by stage1
xg++, which by default uses new libstdc+ just built in stage1.
5) Problem, the new libstdc++ is configured/built against new glibc
because of "--with-build-sysroot". It's incompatible with system C
headers.

So is it reasonable to use "--with-build-sysroot" alone without
"--with-sysroot" when bootstrapping gcc?  If yes,
how should we build binaries in GCC?  Seems to me it's not reasonable
to use new libstdc++ along with system C library since it's built
against new glibc.

Any comments?  Thanks.

Reply via email to