On Tue, Aug 28, 2012 at 10:30 AM, Ilya Basin <basinilya@xxxxxxxxx> wrote: > Hi list! I can't build older gcc on archlinux 64. > > I want to build gcc with bounds checking patches. Bu first I want to > test the build without the patches. > > $ ~/gcc-4.0.2/configure --disable-multilib > $ make BOOT_CFLAGS="-O2" STAGE1_CFLAGS="-O2" CFLAGS="-O2" bootstrap > ... > checking for C compiler default output file name... configure: error: C compiler cannot create executables > See `config.log' for more details. > make[1]: *** [configure-fixincludes] Error 1 > > $ less fixincludes/config.log > configure:1782: gcc -O2 conftest.c >&5 > /usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/cc1: /home/il/build_4.0.2_dir/gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6) Somehow when your existing 4.6.3 GCC runs the dynamic linker is picking up your newly built libgcc_s.so.1. That fails, because your system libstdc++.so.6 requires a version of libgcc_s.so.1 newer than the one in 4.0.2. It is strange that your existing 4.6.3 GCC is dynamically linked against libstdc++.so.6. That does not normally happen. Normally when GCC is built using a C++ compiler it links statically against libstdc++.a. Anyhow, I think this is happening because the top level Makefile is setting LD_LIBRARY_PATH. And I think in GCC 4.0.2 that happens by default, but you can turn it off by using --disable-shared when you run configure. So unless you badly need the GCC 4.0.2 dynamic libraries for some reason, I recommend using --disable-shared. Otherwise hack the top level Makefile.in to stop it from setting LD_LIBRARY_PATH. In that file it's known as RPATH_ENVVAR. Ian