Compiling ATLAS with gcc 4.2 when your OS uses an incompatible gcc

As previously mentioned, gcc4.2 is what the architectural defaults are built for, and previous versions are likely to hurt your performance. For systems with gcc4.1 (the worst-performing gcc for x86 machines), you can usually just install gcc4.2, and change your path so that gcc4.2 is your default compiler. However, between major releases the gcc system libraries change too much for this to work right. Therefore, if your OS was built with gcc3, for example, what will often happen is that executables built with gcc4 will not be able to run, unless you fiddle with your LD_LIBRARY_PATH so that the gcc4 libraries are found before those of gcc3. However, if you do this, then often gcc3-built objects, which include the majority of things you use every day (eg., editors), won't run because they find the gcc4 libraries instead of the expected libs from gcc3!

Therefore, you don't want to make gcc4.2 your default compiler, but you want to have ATLAS use it to compile all the kernel routines, while compiling interface routines and doing any linking with gcc3. To do this, leave the system gcc as the default one in your path, but pass the following flag to configure:

   -Ss kern <path to gcc4.2>

This tells ATLAS to use all non-kernel compilers as normal, but to change all kernel compilers to the given compiler. Therefore, if I have installed gcc4.2 on my gcc3-built OS in my own home area at /home/whaley/local/gcc42, I would add something like:

   -Ss kern /home/whaley/local/gcc42/bin/gcc

R. Clint Whaley 2016-07-28