This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
libstdc++-v3 and LIBCXXFLAGS
- To: libstdc++ at gcc dot gnu dot org
- Subject: libstdc++-v3 and LIBCXXFLAGS
- From: Carlo Wood <carlo at alinoe dot com>
- Date: Thu, 24 May 2001 05:22:54 +0200
Can anyone help me out? I want to compile the compiler (gcc, g++)
with certain CFLAGS, but libraries that get installed with other
flags.
The way I tried is as follows:
env CC=gcc CFLAGS="-O9 -march=pentiumpro -fomit-frame-pointer" \
CXXFLAGS="-O9 -march=pentiumpro -fomit-frame-pointer" \
./gcc-cvs-3.0/contrib/gcc_build \
-d /usr/src/gcc/gcc-cvs-3.0 \
-o ../gcc-objdir-3.0 \
-c "--prefix=/usr/local/gcc-3.0 --enable-shared --with-gnu-as --with-gnu-ld --enable-languages=c++" \
-m "LIBCFLAGS='-O0 -ggdb3 -fno-omit-frame-pointer' \
LIBCFLAGS_FOR_TARGET='-O0 -ggdb3 -fno-omit-frame-pointer' \
LIBCXXFLAGS='-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates' \
LIBCXXFLAGS_FOR_TARGET='-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates'" \
configure
env CC=gcc CFLAGS="-O9 -march=pentiumpro -fomit-frame-pointer" \
CXXFLAGS="-O9 -march=pentiumpro -fomit-frame-pointer" \
./gcc-cvs-3.0/contrib/gcc_build \
-d /usr/src/gcc/gcc-cvs-3.0 \
-o ../gcc-objdir-3.0 \
-c "--prefix=/usr/local/gcc-3.0 --enable-shared --with-gnu-as --with-gnu-ld --enable-languages=c++" \
-m "LIBCFLAGS='-O0 -ggdb3 -fno-omit-frame-pointer' \
LIBCFLAGS_FOR_TARGET='-O0 -ggdb3 -fno-omit-frame-pointer' \
LIBCXXFLAGS='-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates' \
LIBCXXFLAGS_FOR_TARGET='-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates'" \
bootstrap
If I look at the Makefile in gcc-objdir-3.0/Makefile, then I see:
bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean: all-bootstrap
@r=`pwd`; export r; \
s=`cd $(srcdir); pwd`; export s; \
$(SET_LIB_PATH) \
echo "Bootstrapping the compiler"; \
cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
@r=`pwd`; export r; \
s=`cd $(srcdir); pwd`; export s; \
case "$@" in \
*bootstrap4-lean ) \
msg="Comparing stage3 and stage4 of the compiler"; \
compare=compare3-lean ;; \
*bootstrap4 ) msg="Comparing stage3 and stage4 of the compiler"; \
compare=compare3 ;; \
*-lean ) msg="Comparing stage2 and stage3 of the compiler"; \
compare=compare-lean ;; \
* ) msg="Comparing stage2 and stage3 of the compiler"; \
compare=compare ;; \
esac; \
$(SET_LIB_PATH) \
echo "$$msg"; \
cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
@r=`pwd`; export r; \
s=`cd $(srcdir); pwd` ; export s; \
$(SET_LIB_PATH) \
echo "Building runtime libraries"; \
$(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
To test what is actually going on, I edit this file and comment out the lines with $(MAKE)
and add some echo's, making of it:
bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean: all-bootstrap
@r=`pwd`; export r; \
s=`cd $(srcdir); pwd`; export s; \
$(SET_LIB_PATH) \
echo "Bootstrapping the compiler"; \
echo "GCC_FLAGS_TO_PASS = \"$(GCC_FLAGS_TO_PASS)\""; \
#cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
@r=`pwd`; export r; \
s=`cd $(srcdir); pwd`; export s; \
case "$@" in \
*bootstrap4-lean ) \
msg="Comparing stage3 and stage4 of the compiler"; \
compare=compare3-lean ;; \
*bootstrap4 ) msg="Comparing stage3 and stage4 of the compiler"; \
compare=compare3 ;; \
*-lean ) msg="Comparing stage2 and stage3 of the compiler"; \
compare=compare-lean ;; \
* ) msg="Comparing stage2 and stage3 of the compiler"; \
compare=compare ;; \
esac; \
$(SET_LIB_PATH) \
echo "$$msg"; \
#cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
@r=`pwd`; export r; \
s=`cd $(srcdir); pwd` ; export s; \
$(SET_LIB_PATH) \
echo "Building runtime libraries"; \
echo "BASE_FLAGS_TO_PASS = \"$(BASE_FLAGS_TO_PASS)\""; \
echo "RECURSE_FLAGS = \"$(RECURSE_FLAGS)\""; \
echo "pwd = `pwd`"; \
#$(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
This, thus, prints what is actually used to do the 'make's when I bootstrap in the
way I do (running the above script that calls gcc_build), giving:
make[1]: Entering directory `/usr/src/gcc/gcc-objdir-3.0/libiberty'
make[2]: Entering directory `/usr/src/gcc/gcc-objdir-3.0/libiberty/testsuite'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/usr/src/gcc/gcc-objdir-3.0/libiberty/testsuite'
make[1]: Leaving directory `/usr/src/gcc/gcc-objdir-3.0/libiberty'
Bootstrapping the compiler
GCC_FLAGS_TO_PASS = "AR_FLAGS=rc AR_FOR_TARGET=ar AS_FOR_TARGET=as BISON=bison CC_FOR_BUILD=gcc CC_FOR_TARGET=/usr/src/gcc/gcc-objdir-3.0/gcc/xgcc -B/usr/src/gcc/gcc-objdir-3.0/gcc/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-3.0/i686-pc-linux-gnu/include CFLAGS=-O9 -march=pentiumpro -fomit-frame-pointer CFLAGS_FOR_TARGET=-O9 -march=pentiumpro -fomit-frame-pointer CHILLFLAGS=-O9 -march=pentiumpro -fomit-frame-pointer CHILL_FOR_TARGET=/usr/src/gcc/gcc-objdir-3.0/gcc/xgcc -B/usr/src/gcc/gcc-objdir-3.0/gcc/ -L/usr/src/gcc/gcc-objdir-3.0/gcc/ch/runtime/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-3.0/i686-pc-linux-gnu/include CHILL_LIB=-lchill GCJ_FOR_TARGET=/usr/src/gcc/gcc-objdir-3.0/gcc/gcj -B/usr/src/gcc/gcc-objdir-3.0/gcc/ CXX_FOR_BUILD=c++ CXXFLAGS=-O9 -march=pentiumpro -fomit-frame-pointer CXXFLAGS_FOR_TARGET=-O9 -march=pentiumpro -fomit-frame-pointer -fvtable-thunks -D_GNU_SOURCE CXX_FOR_TARGET=/usr/src/gcc/gcc-objdir-3.0/gcc/g++ -B/usr/src/gcc/gcc-objdir-3.0/gcc/ -nostdinc++ -nostdinc++ -I/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/include -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/std -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/c_std -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/libsupc++ -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/libio -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/testsuite -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/backwards -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/ext -L/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src -L/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/local/gcc-3.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-3.0/i686-pc-linux-gnu/include DLLTOOL_FOR_TARGET=dlltool INSTALL=/bin/sh /usr/src/gcc/gcc-cvs-3.0/install-sh -c INSTALL_DATA=/bin/sh /usr/src/gcc/gcc-cvs-3.0/install-sh -c -m 644 INSTALL_PROGRAM=/bin/sh /usr/src/gcc/gcc-cvs-3.0/install-sh -c INSTALL_SCRIPT=/bin/sh /usr/src/gcc/gcc-cvs-3.0/install-sh -c LDFLAGS= LEX=flex LD_FOR_TARGET=ld LIBCFLAGS=-O0 -ggdb3 -fno-omit-frame-pointer LIBCFLAGS_FOR_TARGET=-O0 -ggdb3 -fno-omit-frame-pointer LIBCXXFLAGS=-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates LIBCXXFLAGS_FOR_TARGET=-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates M4=m4 MAKE=make MAKEINFO=makeinfo NM_FOR_TARGET=nm RANLIB_FOR_TARGET=ranlib RPATH_ENVVAR=LD_LIBRARY_PATH SHELL=/bin/sh EXPECT=expect RUNTEST=runtest RUNTESTFLAGS= TARGET_SUBDIR=i686-pc-linux-gnu WINDRES_FOR_TARGET=windres YACC=bison -y bindir=/usr/local/gcc-3.0/bin datadir=/usr/local/gcc-3.0/share exec_prefix=/usr/local/gcc-3.0 includedir=/usr/local/gcc-3.0/include infodir=/usr/local/gcc-3.0/info libdir=/usr/local/gcc-3.0/lib libexecdir=/usr/local/gcc-3.0/libexec lispdir= libstdcxx_incdir= libsubdir=/usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0 localstatedir=/usr/local/gcc-3.0/var mandir=/usr/local/gcc-3.0/man oldincludedir=/usr/include prefix=/usr/local/gcc-3.0 sbindir=/usr/local/gcc-3.0/sbin sharedstatedir=/usr/local/gcc-3.0/com sysconfdir=/usr/local/gcc-3.0/etc tooldir=/usr/local/gcc-3.0/i686-pc-linux-gnu build_tooldir=/usr/local/gcc-3.0/i686-pc-linux-gnu gxx_include_dir=/usr/local/gcc-3.0/include/ gcc_version=3.0 gcc_version_trigger=/usr/src/gcc/gcc-cvs-3.0/gcc/version.c target_alias=i686-pc-linux-gnu 'AR=ar' 'AS=as' 'CC=gcc' 'CXX=c++' 'DLLTOOL=' 'HOST_CC=gcc' 'HOST_PREFIX=' 'HOST_PREFIX_1=loser-' 'NM=nm' 'RANLIB=ranlib' 'WINDRES=' GCC_FOR_TARGET=/usr/src/gcc/gcc-objdir-3.0/gcc/xgcc -B/usr/src/gcc/gcc-objdir-3.0/gcc/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-3.0/i686-pc-linux-gnu/include XFOO= XFOO= XFOO= XFOO= XFOO= XFOO= XFOO= XFOO= XFOO= XFOO="
Comparing stage2 and stage3 of the compiler
Building runtime libraries
BASE_FLAGS_TO_PASS = "AR_FLAGS=rc AR_FOR_TARGET=ar AS_FOR_TARGET=as BISON=bison CC_FOR_BUILD=gcc CC_FOR_TARGET=/usr/src/gcc/gcc-objdir-3.0/gcc/xgcc -B/usr/src/gcc/gcc-objdir-3.0/gcc/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-3.0/i686-pc-linux-gnu/include CFLAGS=-O9 -march=pentiumpro -fomit-frame-pointer CFLAGS_FOR_TARGET=-O9 -march=pentiumpro -fomit-frame-pointer CHILLFLAGS=-O9 -march=pentiumpro -fomit-frame-pointer CHILL_FOR_TARGET=/usr/src/gcc/gcc-objdir-3.0/gcc/xgcc -B/usr/src/gcc/gcc-objdir-3.0/gcc/ -L/usr/src/gcc/gcc-objdir-3.0/gcc/ch/runtime/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-3.0/i686-pc-linux-gnu/include CHILL_LIB=-lchill GCJ_FOR_TARGET=/usr/src/gcc/gcc-objdir-3.0/gcc/gcj -B/usr/src/gcc/gcc-objdir-3.0/gcc/ CXX_FOR_BUILD=c++ CXXFLAGS=-O9 -march=pentiumpro -fomit-frame-pointer CXXFLAGS_FOR_TARGET=-O9 -march=pentiumpro -fomit-frame-pointer -fvtable-thunks -D_GNU_SOURCE CXX_FOR_TARGET=/usr/src/gcc/gcc-objdir-3.0/gcc/g++ -B/usr/src/gcc/gcc-objdir-3.0/gcc/ -nostdinc++ -nostdinc++ -I/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/include -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/std -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/c_std -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/libsupc++ -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/libio -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/testsuite -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/backwards -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/ext -L/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src -L/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/local/gcc-3.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-3.0/i686-pc-linux-gnu/include DLLTOOL_FOR_TARGET=dlltool INSTALL=/bin/sh /usr/src/gcc/gcc-cvs-3.0/install-sh -c INSTALL_DATA=/bin/sh /usr/src/gcc/gcc-cvs-3.0/install-sh -c -m 644 INSTALL_PROGRAM=/bin/sh /usr/src/gcc/gcc-cvs-3.0/install-sh -c INSTALL_SCRIPT=/bin/sh /usr/src/gcc/gcc-cvs-3.0/install-sh -c LDFLAGS= LEX=flex LD_FOR_TARGET=ld LIBCFLAGS=-O0 -ggdb3 -fno-omit-frame-pointer LIBCFLAGS_FOR_TARGET=-O0 -ggdb3 -fno-omit-frame-pointer LIBCXXFLAGS=-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates LIBCXXFLAGS_FOR_TARGET=-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates M4=m4 MAKE=make MAKEINFO=makeinfo NM_FOR_TARGET=nm RANLIB_FOR_TARGET=ranlib RPATH_ENVVAR=LD_LIBRARY_PATH SHELL=/bin/sh EXPECT=expect RUNTEST=runtest RUNTESTFLAGS= TARGET_SUBDIR=i686-pc-linux-gnu WINDRES_FOR_TARGET=windres YACC=bison -y bindir=/usr/local/gcc-3.0/bin datadir=/usr/local/gcc-3.0/share exec_prefix=/usr/local/gcc-3.0 includedir=/usr/local/gcc-3.0/include infodir=/usr/local/gcc-3.0/info libdir=/usr/local/gcc-3.0/lib libexecdir=/usr/local/gcc-3.0/libexec lispdir= libstdcxx_incdir= libsubdir=/usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0 localstatedir=/usr/local/gcc-3.0/var mandir=/usr/local/gcc-3.0/man oldincludedir=/usr/include prefix=/usr/local/gcc-3.0 sbindir=/usr/local/gcc-3.0/sbin sharedstatedir=/usr/local/gcc-3.0/com sysconfdir=/usr/local/gcc-3.0/etc tooldir=/usr/local/gcc-3.0/i686-pc-linux-gnu build_tooldir=/usr/local/gcc-3.0/i686-pc-linux-gnu gxx_include_dir=/usr/local/gcc-3.0/include/ gcc_version=3.0 gcc_version_trigger=/usr/src/gcc/gcc-cvs-3.0/gcc/version.c target_alias=i686-pc-linux-gnu "
RECURSE_FLAGS = "CXX_FOR_TARGET='6142r/gcc/g++ -B6142r/gcc/ -nostdinc++ -L6142r/i686-pc-linux-gnu/libstdc++-v3/src -L6142r/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/local/gcc-3.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-3.0/i686-pc-linux-gnu/include'"
pwd = /usr/src/gcc/gcc-objdir-3.0
Most notably, that shows that the compiler is bootstrapped using:
CFLAGS="-O9 -march=pentiumpro -fomit-frame-pointer"
CFLAGS_FOR_TARGET="-O9 -march=pentiumpro -fomit-frame-pointer"
CXXFLAGS="-O9 -march=pentiumpro -fomit-frame-pointer"
CXXFLAGS_FOR_TARGET="-O9 -march=pentiumpro -fomit-frame-pointer -fvtable-thunks -D_GNU_SOURCE"
LIBCFLAGS="-O0 -ggdb3 -fno-omit-frame-pointer"
LIBCFLAGS_FOR_TARGET="-O0 -ggdb3 -fno-omit-frame-pointer"
LIBCXXFLAGS="-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates"
LIBCXXFLAGS_FOR_TARGET="-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates"
and the "runtime libraries" are build using:
CFLAGS="-O9 -march=pentiumpro -fomit-frame-pointer"
CFLAGS_FOR_TARGET="-O9 -march=pentiumpro -fomit-frame-pointer"
CXXFLAGS="-O9 -march=pentiumpro -fomit-frame-pointer"
CXXFLAGS_FOR_TARGET="-O9 -march=pentiumpro -fomit-frame-pointer -fvtable-thunks -D_GNU_SOURCE"
LIBCFLAGS="-O0 -ggdb3 -fno-omit-frame-pointer"
LIBCFLAGS_FOR_TARGET="-O0 -ggdb3 -fno-omit-frame-pointer"
LIBCXXFLAGS="-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates"
LIBCXXFLAGS_FOR_TARGET="-O0 -ggdb3 -fno-omit-frame-pointer -fno-implicit-templates"
which are the same (note, it added -fvtable-thunks which is a bug: -fvtable-thunks is not supported by 3.0).
However, from the build log I see that it compiled files of libstdc++ as follows. For example:
/usr/src/gcc/gcc-objdir-3.0/gcc/xgcc -B/usr/src/gcc/gcc-objdir-3.0/gcc/ -nostdinc++ -L/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src -L/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/local/gcc-3.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-3.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-3.0/i686-pc-linux-gnu/include -nostdinc++ -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/std -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/c_std -I../include -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/libsupc++ -I../libio -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/libio -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/libmath -O9 -march=pentiumpro -fomit-frame-pointer -fvtable-thunks -D_GNU_SOURCE -fno-implicit-templates -Wall -Wno-format -W -Wwrite-strings -Winline -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -g -c /usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/src/ios.cc -fPIC -DPIC -o .libs/ios.o
Showing that it uses: "-O9 -march=pentiumpro -fomit-frame-pointer -fvtable-thunks -D_GNU_SOURCE -fno-implicit-templates"
which is *NOT* the value of LIBCXXFLAGS (or LIBCXXFLAGS_FOR_TARGET) that was passed.
Please note that using --enable-debug does NOT work because that only adds a -O0
which doesn't negate the -fomit-frame-pointer that is (still) in the CXXFLAGS that
are being used :/.
Bootstrapping the compiler for the sixth time today,
--
Carlo Wood <carlo@alinoe.com>