This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++ and c library compatible issue when bootstrap GCC
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: "Bin.Cheng" <amker dot cheng at gmail dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 29 Jan 2016 14:00:30 +0000
- Subject: Re: libstdc++ and c library compatible issue when bootstrap GCC
- Authentication-results: sourceware.org; auth=none
- References: <CAHFci29EYFAzS2-iZnj+NZw38rmc0qK1wALB89Q227LC0k_jaQ at mail dot gmail dot com>
On 28 January 2016 at 18:19, Bin.Cheng <amker.cheng@gmail.com> wrote:
> Hi,
> 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 base 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.
>
> It's a little tricky. First question is: is it reasonable to use
> "--with-build-sysroot" alone when building/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.
I'm certainly not an expert on using sysroot, but it does seem wrong
to me that it would use system headers which might not be compatible
with the ones in the sysroot.