`configure' Problem: Building within the GCC Tree
Jan-Benedict Glaw
jbglaw at lug-owl.de
Thu Nov 20 16:37:05 UTC 2014
Hi!
As you know, GCC is linked against -lgmp (and if a "gmp" directory is
within GCC's build tree, that is built and GCC is linked against that
copy.)
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?
Thanks,
Jan-Benedict
--
Jan-Benedict Glaw jbglaw at lug-owl.de +49-172-7608481
Signature of: The course of history shows that as a government grows, liberty
the second : decreases." (Thomas Jefferson)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://gmplib.org/list-archives/gmp-discuss/attachments/20141120/d42d9bf8/attachment.bin>
More information about the gmp-discuss
mailing list