I was trying to compile gcc-4.1.2 on Ubuntu x64 10.04 because Maya 2011 requires this version of gcc to be used to compile plugins.
There were several issues I encountered, so here is the process that someone needs to do in order to compile it correctly.
1. You will need to install texinfo
sudo apt-get install texinfo
2. Download gcc-4.1.2 from http://gcc.gnu.org/
3. Create a directory called gcc412
mkdir gcc412
4. CD into it
cd gcc412
5. Make another directory inside called gcc-build. This is important and is almost never mentioned but you need to have two separate directory trees. One of compiling and one for the source.
mkdir gcc-build
6. Copy the gcc archive to the gcc412 directory and unpack the archive there. Not in the build one.
cp gcc-4.1.2.tar.bz2 .../gcc412
cd .../gcc412
tar jxvf gcc-4.1.2.tar.bz2
7. Go to the build directory
cd gcc-build
8. Now you need to configure . In the Maya documentation they say you need to do this:
../gcc-4.1.2/configure --prefix=/opt/gcc412 --program-suffix=412 --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --disable-libunwind-exceptions --enable-__cxa_atexit
But I was having problems if I use these options only so for me this worked instead:
../gcc-4.1.2/configure --prefix=/opt/gcc412 --program-suffix=412 --enable-shared --enable-threads=posix --enable-checking=release --disable-libunwind-exceptions --enable-__cxa_atexit --disable-multilib
Notice the --disable-multilib flag and the missing --with-system-zlib flag.
9. Now because gcc-4.1.2 has a bug and thinks that versions of makeinfo greater than 10 are actually lower than 9 we need to do something manually. In our case if you run makeinfo --version you will see which version was installed by the first step, but it's usually version 13. Open the Makefile that was created by the ./configure and edit the line where it says:
MAKEINFO = /opt/YOURUSERNAME/newlib-1.15.0/missing makeinfo
and change it to:
MAKEINFO = makeinfo
Save the file.
10. After the configuration run make
make -j 2 bootstrap
11. Run make install as root after that.
su root
make install
12. Then for convenience you can link the freshly compiled gcc412 to point to usr/bin
ls -s /opt/gcc412/bin/gcc412 /usr/bin/gcc412
I hope this will be in help of somebody else that is struggling with compiling it.