http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56271
Bug #: 56271 Summary: GCC build errors when building ada and using LDFLAGS Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassig...@gcc.gnu.org ReportedBy: karlso...@gmail.com Host: i686-pc-mingw32 Target: i686-pc-mingw32 Build: x86_64-w64-mingw32, i686-w64-mingw32 GCC is configured with LDFLAGS="-L/home/xxx/mingw-w64/packages/gcc/packages/gmp/gmp-5.1.0-i686/lib" ../../source/gcc-4.7.2/configure --build=i686-pc-mingw32 --host=i686-pc-mingw32 --target=i686-w64-mingw32 --disable-nls --disable-multilib --prefix=/home/xxx/mingw-w64/mingw-w64-i686 --with-sysroot=/home/xxx/mingw-w64/mingw-w64-i686 --with-native-system-header-dir=/i686-w64-mingw32/include --with-host-libstdcxx=/mingw/lib/gcc/mingw32/4.7.2/libstdc++.a --disable-cloog-version-check --disable-ppl-version-check --with-mpc=/home/xxx/mingw-w64/packages/gcc/packages/mpc/mpc-1.0.1-i686 --with-mpfr=/home/xxx/mingw-w64/packages/gcc/packages/mpfr/mpfr-3.1.1-i686 --with-gmp=/home/xxx/mingw-w64/packages/gcc/packages/gmp/gmp-5.1.0-i686 --with-ppl=/home/xxx/mingw-w64/packages/gcc/packages/ppl/ppl-1.0-i686 --with-isl=/home/xxx/mingw-w64/packages/gcc/packages/isl/isl-0.11.1-i686 --with-cloog=/home/xxx/mingw-w64/packages/gcc/packages/cloog-ppl/cloog-ppl-0.15.11-i686 --enable-languages=ada,c,c++ --enable-threads=win32 --enable-fully-dynamic-string --disable-sjlj-exceptions --with-multilib-list=m32 --with-arch=pentium3 --enable-leading-mingw64-underscores --with-dwarf2 --enable-lto --disable-win32-registry --with-win32-nlsapi=unicode --enable-libstdcxx-debug Building ada is always produce some errors like if [ -f gnat1.exe ] ; \ then \ make "ADA_CFLAGS=" "BISON=bison" "BISONFLAGS=" "CFLAGS=-pipe -D__USE_MINGW_ACCESS " "LDFLAGS=-L/home/xxx/mingw-w64/packages/gcc/packages/gmp/gmp-5.1.0-i686/lib "FLEX=flex" "FLEXFLAGS=" "LN=ln" "LN_S=cp -pR" "MAKEINFO=makeinfo--split-size=5000000" "MAKEINFOFLAGS=--no-split" "MAKEOVERRIDES=" "SHELL=/bin/sh" "exeext=.exe" "build_exeext=.exe" "objext=.o" "exec_prefix=/home/xxx/mingw-w64/mingw-w64-i686" "prefix=/home/xxx/mingw-w64/mingw-w64-i686" "local_prefix=/usr/local" "gxx_include_dir=/home/xxx/mingw-w64/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/c++/4.7.2" "build_tooldir=/home/xxx/mingw-w64/mingw-w64-i686/i686-w64-mingw32" "gcc_tooldir=/home/xxx/mingw-w64/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32" "bindir=/home/xxx/mingw-w64/mingw-w64-i686/bin" "libexecsubdir=/home/xxx/mingw-w64/mingw-w64-i686/libexec/gcc/i686-w64-mingw32/4.7.2" "datarootdir=/home/xxx/mingw-w64/mingw-w64-i686/share" "datadir=/home/xxx/mingw-w64/mingw-w64-i686/share" "localedir=/home/xxx/mingw-w64/mingw-w64-i686/share/locale" "ADA_FOR_BUILD=" "ADA_INCLUDE_DIR=/home/xxx/mingw-w64/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.7.2/adainclude" "ADA_RTL_OBJ_DIR=/home/xxx/mingw-w64/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.7.2/adalib" "ADAFLAGS=-gnatpg -gnata -gnatwns -W -Wall" "ADA_FOR_TARGET=" "INSTALL=/bin/install -c" "INSTALL_DATA=/bin/install -c -m 644" "INSTALL_PROGRAM=/bin/install -c" install-gnatlib; \ fi /bin/sh: -c: line 2: unexpected EOF while looking for matching `"' /bin/sh: -c: line 4: syntax error: unexpected end of file make[1]: [ada.install-common] Error 2 (ignored) As you can see make parameter "LDFLAGS=... don't have closing double quote. The reason for this is as follows: 'root' Makefile adds to LDFLAGS: LDFLAGS += -Wl,--stack,12582912 , so ./gcc/Makefile has LDFLAGS = -L/home/Karlson/mingw-w64/packages/gcc/packages/gmp/gmp-5.1.0-i686/lib -Wl,--stack,12582912 that flag in included into FLAGS_TO_PASS by FLAGS_TO_PASS = \ "ADA_CFLAGS=$(ADA_CFLAGS)" \ "BISON=$(BISON)" \ "BISONFLAGS=$(BISONFLAGS)" \ "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ "LDFLAGS=$(LDFLAGS)" \ "FLEX=$(FLEX)" \... which is filtered in included makefile source/gcc/ada/gcc-interface/Make-lang.in: COMMON_FLAGS_TO_PASS = $(filter-out -pedantic -W%, $(FLAGS_TO_PASS)) This filter is supposed to exclude '-pedantic' and all warning control flags, but in real: 1. Don't filter out option not surrounded by spaces, like CFLAGS=-pedantic 2. With '-W%' filter out with closing quote in "LDFLAGS=-L/some/path -Wl,--stack,12582912" 3. Filter out all -Wp,... -Wl,... -Wa,.. options as well