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

            Bug ID: 127954
           Summary: Configuring with non-default location of GMP only
                    fails to build quite late in the process
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: build
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

On systems where GMP isn't available in /usr/include, but is available in some
prefix that the compiler used to build GCC knows about, stage1 will build fine
without --with-gmp, yet fail in stage2 when we're using the just-built compiler
that knows nothing about that prefix, unless you happen to configure it in the
same way.

This is another way to get the errors from PR55784 and PR56704.

It is still user error as they didn't configure correctly, but figuring that
out is unnecessarily hard.

In my case, my host GCC is:
```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix7.2.0.0/13/lto-wrapper
Target: powerpc-ibm-aix7.2.0.0
Configured with: ../gcc-13.3.0/configure --prefix=/opt/freeware
--mandir=/opt/freeware/man --infodir=/opt/freeware/info
--with-local-prefix=/opt/freeware --enable-languages=c,c++,fortran,go
--enable-version-spe
c-runtime-libs --disable-nls --disable-libstdcxx-pch --disable-werror
--enable-libstdcxx-filesystem-ts --with-gcc-major-version-only
--program-suffix=-13 --with-cpu=default32 --host=powerpc-ibm-aix7.2.0.0
--witbiconv-prefix=/opt/freeware/libiconv_static --with-libiconv-type=static
--with-included-gettext
Thread model: aix
Supported LTO compression algorithms: zlib zstd
gcc version 13.3.0 (GCC)
```
so for all of building stage1, we're able to find GMP just fine as it's in the
prefix of that compiler. When building GCC, I just have bare configure.

The best fix seems to me to be a configure test in gcc/configure.ac right
under:
```
# We will need to find libiberty.h and ansidecl.h
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
saved_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
```

as that's where we start to need system.h, but maybe we can try document it
better instead. Thoughts?

Reply via email to