Following the official guid:
http://help.autodesk.com/cloudhelp/2015/ENU/Maya-SDK/files/Setting_up_your_build_environment_Linux_environments_32bit_and_64bit.htm
I still encountered several errors, and here is the way how I came out.
Here is the steps in the offical guid, and I add my annotation.
Download the gcc 4.1.2 source tar file from http://gcc.gnu.org/install/ // I download the package in this page: https://gcc.gnu.org/releases.html Setup directories:
% mkdir gcc412 // My directory is /home/user0/tools/gcc412
% cd gcc412
% mkdir gcc-build // My directory is /home/user0/tools/gcc412/build Extract the source files:
% tar zxvf gcc-4.1.2.tar.gz // I unzip the package in /home/user0/tools/gcc412/src
% cd gcc-build // for me, it is /home/user0/tools/gcc412/build Configure the compiler. Run the following all on 1 line:
../src/configure --prefix=/opt/gcc412 --program-suffix=412 --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --disable-libunwind-exceptions --enable-__cxa_atexit Build the compiler:
% make -j 2 bootstrap
Note:
0. you need to install glibc-devel.i686, you can run this command:
#yum install glibc-devel.i686 1. It may fail if your display driver is nvidia-x11-drv-340.32-1. You have to update your display driver to nvidia-x11-drv-340.32-2. If you installed nvidia-x11-drv-340.32-1 with Nvidia installer, you can read this post for updating your driver: nvidia-xhttps://www.centos.org/forums/viewtopic.php?t=24137,
And if you installed 1nvidia-x11-drv-340.32-1 with yum, you can use the following commands to update your driver:
#yum clean all
#yum --disablerepo=\* --enablerepo=elrepo install kmod-nvidia nvidia-x11-drv
#yum --disablerepo=\* --enablerepo=elrepo install nvidia-x11-drv-32bit
(See this post for more details: https://www.centos.org/forums/viewtopic.php?f=48&t=48236) 2. It has a compiling error when you build gcc4.1.2:
../gcc/config/i386/linux-unwind.h:138:17: error: field 'info' has incomplete type "
And here is the solution: http://forge.ispras.ru/issues/4295
It means that you need to change the code on line 136 in linux-unwind.h:
struct rt_sigframe {
int sig;
struct siginfo *pinfo;
void *puc;
struct siginfo info;
} *rt_ = context->cfa;
to
struct rt_sigframe {
int sig;
siginfo_t *pinfo;
void *puc;
siginfo_t info;
struct ucontext uc;
} *rt_ = context->cfa;
You can download the modified file in http://files.cnblogs.com/yaoyansi/gcc412_build.zip. 3. It has a link error: .libs/libgcj.so: undefined reference to `__cxa_call_unexpected'.
And here is the solution: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50888, it shows you how to modify libjava/prims.cc.
You can download the modified file in http://files.cnblogs.com/yaoyansi/gcc412_build.zip,
After you modify /home/user0/tools/gcc412/src/libjava/prims.cc, remove /home/user0/tools/gcc412/build/gcc/gcc.o and build it again. 4. It complains:
creating gij
GC Warning: Repeated allocation of very large block (appr. size 1048576000):
May lead to memory leak and poor performance.
GC Warning: Out of Memory! Returning NIL!
GC Warning: Repeated allocation of very large block (appr. size 1048576000):
May lead to memory leak and poor performance.
GC Warning: Out of Memory! Returning NIL!
Exception during runtime initialization
java.lang.OutOfMemoryError
<<No stacktrace available>> In /home/user0/tools/gcc412, I searched all gij.o and gcc.o, and removed them, then built it again.
Install compiler as root:
% su root
% make install // gcc412 is installed in /opt/gcc412/ Note: you can make a symlink in /usr/bin to make the call to gcc easier for the
user:
% cd /usr/bin
% ln -s /opt/gcc412/bin/gcc412 .
% ln -s /opt/gcc412/bin/g++412 .