Install gcc-4.5.3 under ubuntu10.10

Source: Internet
Author: User
Tags gmp

Ubuntu10.10 does not have g ++ installed by default. Therefore, many source code installations will prompt that the G ++ command is not found during configure, here I will introduce my experience in installing the new version of GCC under Ubuntu, download the gcc-4.5.3 installation, the process will prompt the followingGCC configure: Error: Building GCC requires GMP 4.2 +, mpfr 2.3.1 + and MCM 0.8.0 +Obviously, the lack of GMP, MPC, and mpfr can be found on the GCC official website. Because mpfr depends on GMP, while nmpa depends on GMP and mpfr, it is necessary to install GMP first, followed by mpfr, the last is the MPC.

Install GMP first and decompress tar vxf. Here, we take GMP as an example to introduce a good source code installation habit. Go to the GMP directory and execute the following command:

Mkdir GMP-build

Cd gmp-build

../Configure-Prefix =/usr/local/GCC

Make

Make check

Sudo make install

The key habits are: 1. Create a temporary compilation directory. In this example, the directory is GMP-build. This allows you to delete the directory after the installation is complete, thus saving space, and keep the source code directory clean; 2. Install it to the specified directory. In this example, It is/usr/local/GCC. It is best to install several related files in the same folder, for example, the GCC folder is easy to manage. Otherwise, all files are installed under/usr/local by default, which is messy. 3. Check the files after compilation. In this example, make check is used, prevent install directly after make fails, and some inexplicable errors may occur. For more tips on installing source code, refer to my other article on how to install source code in Linux.

Follow these steps to install mpfr and MCM. After both are completed, you can install GCC. Here, we solemnly remind you,There must be no less2GHard Disk of is emptyOtherwise, if the compilation half prompts that the disk space is insufficient, you will be depressed. In configure, enter the following command: configure -- prefix =/usr/local/GCC -- enable-threads = POSIX -- disable-checking -- disable-multilib -- enable-versions ages = C, C ++. For example, if you encounter ** installation, refer to my Linux source code installation experience. You will find the answer. After configure, make will take more than two hours. Wait !! After the installation is complete, try the G ++ command. If the execution is successful, you will be lucky. You will not need to read it later. Otherwise, you will be unlucky to look down...

The new version of GCC cannot be used because its execution file has not been added to the command search path. To/usr/bin, enter the command to create a soft link as follows:

Sudo ln-S/usr/local/GCC/bin/GCC gcc45
Sudo ln-S/usr/local/GCC/bin/g ++ 45

In this way, you can use the G ++ command. However, another step is to add the paths of the three previously installed libraries to LD_LIBRARY_PATH. Otherwise, errors will occur during compilation. How can this problem be solved, I have mentioned the article twice. I can't go and see it! After the restart, you can use it !! Wish you success

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.