Precautions for replacing the original gcc version with multi-version gcc

Source: Internet
Author: User
Tags symlink
Precautions for replacing the original version of gcc with multi-version gcc-general Linux technology-Linux programming and kernel information. The following is a detailed description. As we all know, gcc can be stored in multiple versions of the same memory. Therefore, many times in order to test the new version of gcc and avoid having too many impacts on the original system, I will install the new gcc in/opt (use -- prefix =/opt/gcc-xxx in configure ), then, use the symlink method in/usr/bin to switch between the old and new versions, even though the old versions are not switched back in most cases...

The case is that the toolchain that really constructs the system is the gcc-4.0.3 (-- prefix =/usr, in/usr/bin), and then gcc has gone through several upgrades, so/opt is equipped with gcc-4.1.2, gcc-4.2.0 and the latest gcc-4.2.1

Since gcc-4.2.1 is the bugfix release of the gcc-4.2.x, And the gcc-4.2 is superior to the previous generation of performance, coupled with the gcc-4.2 has been used for a long time, so I think the old version of gcc in the system is really redundant, in this way, I decided to take out all old versions, leaving only new versions. Since the use of paco, to be careful, or with paco first hit a few gcc-xxx-paco.tar.gz package to start

After killing, you only need to create several symlinks in/usr/bin corresponding to/opt/gcc-4.2.1/bin, including:

Gcc
G ++
C ++
Cpp
Gcov
Gccbug
I686-linux-pc-xxxx
And/lib/cpp.

Okay, it seems that everything is correct. The Compiling Program is normal, but the problem arises. Some previously running programs, such as xpdf, kpdf, and kwrite, are successively server errors and cannot find libgcc_s.so.1, check/opt/gcc-4.2.1/lib is there, and then carefully proofread, finally know the problem. The original is to kill the gcc-4.0.3 in the original system, the system/lib/libgcc_s.so.1 is also removed, the formation of the program can not find the library and server error, this is easy to do, create a symlink to/opt/gcc-4.2.1/lib on the line?

Haha, It was amazing that everything went back to normal.

Here are two things:
1. in the case of multi-version gcc, even if the program is compiled by the new version of gcc, it may still find the old version of gcc library in the default library path for use. In this case, you only need to make a slight correction.

2. When the new gcc version is installed in a non-overwriting mode, pay attention to the path of the execution file and related libraries.

Postscript:
I am not an expert. I have experience based on trial-and-error. please correct me if you have any mistakes.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.