http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45920
Summary: Building gcc: flags passed during configure step not used everywhere Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassig...@gcc.gnu.org ReportedBy: phant...@gmail.com I'm on a network with a hodgepodge of tools of varying versions, and I'm attempting to remedy the problem, but I can only build from sources for this particular environment. The build target is sparcv9-sun-solaris2.10, and I configured with: mkdir /usr1/tools/gcc-4.5.1-build cd /usr1/tools/gcc-4.5.1-build ../gcc-4.5.1/configure --prefix=/usr1/local/gcc-4.5.1 \ --with-gmp=/usr1/local/gmp-5.0.1 \ --with-mpfr=/usr1/local/mpfr-3.0.0 \ --with-mpc=/usr1/local/mpc-0.8.2 \ --build=sparcv9-sun-solaris2.10 \ --enable-languages='c,c++' \ --with-stage1-ldflags='-O2 -m64 -mptr64 -mcpu=v9' \ --with-boot-ldflags='-O2 -m64 -mptr64 -mcpu=v9' \ CC=/opt/csw/gcc3/bin/gcc \ CFLAGS='-O2 -m64 -mptr64 -mcpu=v9' \ CPPFLAGS='-O2 -m64 -mptr64 -mcpu=v9' \ BOOT_CFLAGS='-O2 -m64 -mptr64 -mcpu=v9' \ LDFLAGS='-O2 -m64 -mptr64 -mcpu=v9' The overload of flags is from me trying to find some way to get the portion I encountered problems with to use the right flags. During stage 1 (stage_last and stage_current both say stage 1 in them), it enters the <build>/gcc directory and executes the Makefile there. It fails after building (gensupport?) and errors when it tries to link them. The link step has the appropriate flags to target a 64-bit platform, but the other two object files target ELF32. The error I was receiving was "wrong ELF class, ELFCLASS32" during link. On line 3675 or so of (...)/gcc/Makefile, it has the following line: $(COMPILER_FOR_BUILD) -c $(BUILD_COMPILERFLAGS) $(BUILD_CPPFLAGS) \ -o $@ $< Neither BUILD_COMPILERFLAGS or BUILD_CPPFLAGS contain the appropriate flags I set during the configure step. Furthermore, around line 136 the CFLAGS line is empty -- which is probably the cause. As a temporary workaround I added appropriate flags to line 136.