Today, after another day, when the upgrade was successful, I was so touched that I cried... No more. It's tears...
In fact, it is not difficult to upgrade. It is really not difficult at all. The point is that they are stuck in their own documents ..
System centos 6.3 32-bit i386 comes with GCC 4.4.6 upgrade to GCC 4.8
Reference: http://www.cnblogs.com/zhangtingkuo/archive/2013/04/06/3002982.html
Http://blog.csdn.net/magicyang87/article/details/7972169
1. Download the source code package
Wget http:
// Ftp.gnu.org/gnu/gcc/gcc-4.8.0/gcc-4.8.0.tar.bz2
Decompress:
Tar-jxvf gcc-4.8.0.tar.bz2
2. Download the dependent libraries required for compilation
CD gcc-4.8.0
./Contrib/download_prerequisites
CD ..
3. Create a compilation output directory
Mkdir gcc-build-4.8.0
4. Go to the directory and run the following command to generate the MAKEFILE file.
CD gcc-build-4.8.0
../Gcc-4.8.0/configure -- enable-checking = release -- enable-packages ages = C, C ++ -- disable-multilib
5. Compile
Make-J4
If the compilation is successful, it will take a long time, about half an hour, so it should be very happy if you see that it has never stopped immediately after the output!
6. Install Sudo make install
7. Switch GCC to the new version Determine the path of the newly installed gcc The default value is/usr/local/bin. You can first updatedb, and then locate the gcc-4.8 | tail look for LS/usr/local/bin | grep gcc Add a new GCC to an option. The third to the last is the name, and the second to the last is the new GCC path. The last parameter 40 is the priority. The new version will be automatically used when the value is larger.
Update-alternatives -- install/usr/bin/GCC gcc/usr/local/bin/i686-pc-linux-gnu-gcc 40
8. confirm that the current version has been switched to the new version. Gcc-V I am remotely using SSH here. I found that the version has not changed. I disconnected and re-generated the session and found it changed to 4.8! Does it look good ?! I don't know how many detours I 've taken! The following is a bitter history .. ============================================================ ======== First, refer to the blog of our great boss, http://blog.csdn.net/yanxiangtianji/article/details/8365630.
Pit 1,Libstdc ++-static This process is also integrated with various blogs, because most of the first steps on the Internet are: Yum install glibc-static libstdc ++-static-y Actually, there is no centos source at all. Libstdc ++-static The first one is yes. Please install it. According to the tutorial, compile make, view the config. log file in the directory, and search for err. Static - Libstdc ++ Error! Now I can take it seriously. Install libstdc ++-static. First of all, for centos source, for the source of 163 (http://www.cnblogs.com/peterpanzsy/archive/2013/04/07/3003387.html), no, then run the oschina on the question, the great God said epel source should have, so for epel source, still no fart! So I went to the RPM package, and there were not many centos packages. I had to go to the fedora package. One family can try it, and the epel source is also common. Rpm-ivh xxx. rpm
As a result, the dependency problem occurs, so there are a bunch: However, when the first version is installed, it conflicts with the 4.4.6 version of the system. Nima and Yum remove are unable to uninstall the built-in GCC 4.4.7 because the dependency is not feasible, it is still necessary to compile a new GCC later, so it cannot be impulsive. This morning was a mess. I got the kernel error and spent an hour reinstalling the system in the afternoon.
Another reason is that he mistakenly thought that 6.3 of centos was successfully installed on yum. Libstdc ++-static So I switched to centos6.3 when I reinstalled it. It started with 6.4. At last, I found that 6.3 of the source does not have this magic thing.
ThereforeLibstdc ++-staticDesperate... Give up.
Problem 2: whether to manually compile and install the three dependent libraries.
Go to the GCC directory and run:
./Contrib/download_prerequisites
The following three dependent libraries are loaded in the correct version.
It is a pity that it cannot be automatically configured for compilation and installation. You can execute it using the script I wrote (assuming it is currently in the contrib folder ):
CD GMD
./Configure
Make install
CD ../mpfr
./Configure
Make install
CD ../MCM
./Configure
Make install, but are you sure you want to install it? After Nima is installed, there will be problems! At least in my practice. I accidentally saw someone say this on the Internet. After a manual installation, compile GCC and directly report two errors to stop. Then, the first step is found. Libstdc ++-static Error. After skipping the manual installation of GMD mpfr nmpc, the compilation was successful...
Pitfalls 3. Shared Library Path Problems The above three shared libraries are not in the default system path. We can search for: locate MPC | grep so does have/usr/local/lib/libmp C. So
However, when I /Etc/lD. So. conf After the/usr/local/lib path is added under. D and ldconfig is executed, an error is returned. It is estimated that the following legal library files are not found. Therefore, it is removed without any impact. I really don't know how complicated it is ..