`configure' Problem: Building within the GCC Tree

Marc Glisse marc.glisse at inria.fr
Mon Nov 24 18:13:03 UTC 2014

On Thu, 20 Nov 2014, Jan-Benedict Glaw wrote:

>  I updated GCC's copy of `missing' these days, leading to an
> interesting bug report: With an in-tree copy of GMP, configure would
> fail in the GMP build directory if flex/lex are both missing:
> [...]
> checking for flex... /home/jbglaw/src/toolchain/gcc/missing flex
> checking lex output file root... configure: error: cannot find output from /home/jbglaw/src/toolchain/gcc/missing flex; giving up
> make[2]: *** [configure-stage1-gmp] Error 1
> make[2]: Leaving directory `/home/jbglaw/src/toolchain/gcc'
> This is due to a slight change of behavior in `missing'. Older
> versions try to fake flex's action if both a .c and a .l file can be
> found. With newer versions of `missing' (ie. those after June 15th,
> 2012), a missing tool will just produce an error.
>  What happens with building GMP within GCC's tree is that GCC's
> configure / Makefile initially detect that there's no flex/lex and so
> they set $FLEX and $LEX to the `missing' tool. These variables are
> then passed down to GMP's `configure' (tested with 4.3.2 and 6.0.0a
> tarballs). Using current GCC (from SVN or GIT), GCC automatically
> configures GMP like this (I removed the '@' from GCC's Makefile
> manually):
> r=`${PWDCMD-pwd}`; export r; \
>        s=`cd .; ${PWDCMD-pwd}`; export s; \
>        TFLAGS=""; \
>        test ! -f host-x86_64-unknown-linux-gnu/gmp/Makefile || exit 0; \
>        FLEX="/home/jbglaw/src/toolchain/gcc/missing flex"; export FLEX; LEX="/home/jbglaw/src/toolchain/gcc/missing fl
> ex"; export LEX; BISON="bison"; export BISON; YACC="bison -y"; export YACC; M4="m4"; export M4; SED="/bin/sed"; export SED; AWK="gawk"; export AWK; MAKEINFO="makeinfo --split-size=5000000 --split-size=5000000"; export MAKEINFO; CC="gcc"; export CC; ADA_CFLAGS=""; export ADA_CFLAGS; CFLAGS="-g -O2"; export CFLAGS; CONFIG_SHELL="/bin/bash"; export CONFIG_SHELL; CXX="g++"; export CXX; CXXFLAGS="-g -O2"; export CXXFLAGS; GCJ=""; export GCJ; GFORTRAN=""; export GFORTRAN; GOC=""; export GOC; AR="ar"; export AR; AS="as"; export AS; CC_FOR_BUILD="gcc"; export CC_FOR_BUILD; DLLTOOL="dlltool"; export DLLTOOL; LD="ld"; export LD; LDFLAGS="-static-libstdc++ -static-libgcc "; export LDFLAGS; NM="nm"; export NM; RANLIB="ranlib"; export RANLIB; WINDRES="windres"; export WINDRES; WINDMC="windmc"; export WINDMC; OBJCOPY=""; export OBJCOPY; OBJDUMP="objdump"; export OBJDUMP; READELF="readelf"; export READELF; AR_FOR_TARGET="ar"; export AR_FOR_TARGET; AS_FOR_TARGET="as"; export AS_FOR_TARGET; GCC_FOR_TARGET=" $r/host-x86_64-unknown-linux-gnu/gcc/xgcc -B$r/host-x86_64-unknown-linux-gnu/gcc/"; export GCC_FOR_TARGET; LD_FOR_TARGET="ld"; export LD_FOR_TARGET; NM_FOR_TARGET="nm"; export NM_FOR_TARGET; OBJDUMP_FOR_TARGET="objdump"; export OBJDUMP_FOR_TARGET; RANLIB_FOR_TARGET="ranlib"; export RANLIB_FOR_TARGET; READELF_FOR_TARGET="readelf"; export READELF_FOR_TARGET; TOPLEVEL_CONFIGURE_ARGUMENTS="./configure --disable-multilib"; export TOPLEVEL_CONFIGURE_ARGUMENTS; HOST_LIBS=""; export HOST_LIBS; GMPLIBS="-L$r/host-x86_64-unknown-linux-gnu/gmp/.libs -L$r/host-x86_64-unknown-linux-gnu/mpfr/.libs -L$r/host-x86_64-unknown-linux-gnu/mpc/src/.libs -lmpc -lmpfr -lgmp"; export GMPLIBS; GMPINC="-I$r/host-x86_64-unknown-linux-gnu/gmp -I$s/gmp -I$r/host-x86_64-unknown-linux-gnu/mpfr -I$s/mpfr -I$s/mpc/src "; export GMPINC; ISLLIBS="-L$r/host-x86_64-unknown-linux-gnu/isl/.libs  -lisl"; export ISLLIBS; ISLINC="-DCLOOG_INT_GMP -I$r/host-x86_64-unknown-linux-gnu/isl/include -I$s/isl/include"; export ISLINC; LIBELFLIBS="@libelflibs@" ; export LIBELFLIBS; LIBELFINC="@libelfinc@" ; export LIBELFINC; LD_LIBRARY_PATH=`echo "$r/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs:$r/x86_64-unknown-linux-gnu/libsanitizer/.libs:$r/x86_64-unknown-linux-gnu/libvtv/.libs:$r/x86_64-unknown-linux-gnu/libcilkrts/.libs:$r/x86_64-unknown-linux-gnu/libssp/.libs:$r/x86_64-unknown-linux-gnu/libgomp/.libs:$r/x86_64-unknown-linux-gnu/libitm/.libs:$r/x86_64-unknown-linux-gnu/libatomic/.libs:$r/host-x86_64-unknown-linux-gnu/gcc:$r/host-x86_64-unknown-linux-gnu/prev-gcc:$LD_LIBRARY_PATH" | sed 's,::*,:,g;s,^:*,,;s,:*$,,'`; export LD_LIBRARY_PATH; LD_LIBRARY_PATH=`echo "$r/host-x86_64-unknown-linux-gnu/gmp/.libs:$r/host-x86_64-unknown-linux-gnu/prev-gmp/.libs:$r/host-x86_64-unknown-linux-gnu/mpfr/.libs:$r/host-x86_64-unknown-linux-gnu/prev-mpfr/.libs:$r/host-x86_64-unknown-linux-gnu/mpc/.libs:$r/host-x86_64-unknown-linux-gnu/prev-mpc/.libs:$r/host-x86_64-unknown-linux-gnu/isl/.libs:$r/host-x86_64-unknown-linux-gnu/prev-isl/.libs:$LD_LIBRARY_PATH" | sed 's,::*,:,g;s,^:*,,;s,:*$,,'`; export LD_LIBRARY_PATH; \
>        CFLAGS="-g"; export CFLAGS; \
>        CXXFLAGS="-g"; export CXXFLAGS; \
>        LIBCFLAGS="-g -O2"; export LIBCFLAGS;  \
>        echo Configuring stage 1 in host-x86_64-unknown-linux-gnu/gmp ; \
>        /bin/bash ./mkinstalldirs host-x86_64-unknown-linux-gnu/gmp ; \
>        cd host-x86_64-unknown-linux-gnu/gmp || exit 1; \
>        case . in \
>          /* | [A-Za-z]:[\\/]*) topdir=. ;; \
>          *) topdir=`echo host-x86_64-unknown-linux-gnu/gmp/ | \
>                sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `. ;; \
>        esac; \
>        module_srcdir=gmp; \
>        /bin/bash $s/$module_srcdir/configure \
>          --srcdir=${topdir}/$module_srcdir \
>          --cache-file=./config.cache  '--disable-multilib' '--enable-languages=c,c++,fortran,java,lto,objc' --program-transform-name='s,y,y,' --disable-option-checking --build=x86_64-unknown-linux-gnu --host=none-unknown-linux-gnu \
>          --target=none-unknown-linux-gnu \
>           \
>          --disable-intermodule --enable-checking=yes,types --disable-coverage --enable-languages="c,c++,lto" --disable-build-format-warnings \
>          --disable-shared
> So... How do we solve that oddity? I'm not even 100% sure where the
> actual problem arises: Is it that GCC supplies a (F)LEX variable
> with a non-working (f)lex?  Or should flex only be needed for
> "maintainer mode"? After all, these were released tarballs.
>  There are probably several ways to fix this, but none of those looks
> obviously correct to me. What's your opinion on this?

Someone is *explicitly* telling GMP to use LEX=nonsense. When configure 
detects that, the most logical behavior seems to be to stop and tell the 
user about it (which is apparently what happens). If no LEX was provided 
and autodetection didn't find one, it would make sense to keep going and 
possibly disable anything (1 demo ?) that depends on flex (I didn't check 
what happens).

It would be possible to ignore broken explicit options, but I don't think 
that would be an improvement.

(I don't know configure well, I am not the one you need to convince, etc, 
so don't take it as a definitive answer from the GMP project, just the 
opinion of someone who may not have all the relevant info)

Marc Glisse

More information about the gmp-discuss mailing list