How to install and compile gcc4.8
This article mainly introduces how to install and compile gcc4.8, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to know about it.
Get GCC 4.8.2 package: wget http://gcc.skazkaforyou.com/releases/gcc-4.8.2/gcc-4.8.2.tar.gz
Unzip: tar-xf gcc-4.8.2.tar.gz
Install the dependent library and enter the directory gcc-4.8.2 to execute. / contrib/download_prerequisites
Create the output directory required for compilation and put it into the directory: mkdir gcc-build-4.8.2;cd gcc-build-4.8.2
Execute.. / gcc-4.8.2/configure-- enable-checking=release-- enable-languages=c,c++-- disable-multilib
Error: gcc configure: error: Building GCC requires GMP 4.2, MPFR 2.3.1 + and MPC 0.8.0 install these three tools
After downloading the corresponding installation packages in the installation sequence: (GMP4.3.2&MPC1.0.1&MPFR3.1.3)
1. Start installing GMP. After unzipping the GMP package, you get the source code directory gmp-4.3.2. Create a temporary compilation directory under the same level of the directory, which is named tempGMP.
Enter the tempGMP directory and enter the following command to configure:
.. / gmp-4.3.2/configure-- prefix=/home/gmp-4.3.2
Make-J4
Sudo make install
two。 Install mpfr again. After unzipping the mpfr package, you get the source code directory mpfr-3.1.3. Create a temporary compilation directory under the same level of the directory, which is named tempMPFR.
Enter the tempMPFR directory and enter the following command to configure:
.. / mpfr-3.1.3/configure-- prefix=/home/mpfr-3.1.3-- with-gmp=/home/gmp-4.3.2
Make-J4
Sudo make install
two。 Finally, install mpc. After unzipping the mpc package, you get the source code directory mpc-1.0.1. Create a temporary compilation directory under the same level of the directory, which is named tempMPC.
Enter the tempMPC directory and enter the following command to configure:
.. / mpc-1.0.1/configure-- prefix=/home/mpc-1.0.1-- with-gmp=/home/gmp-4.3.2-- with-mpfr=/home/mpfr-3.1.3
Make-J4
Sudo make install
Pit 1: if you encounter "configure: error: could not find a working compiler" when using three plug-ins configure
Fix: add "--build=x86_64-linux" at the end of the command (the problem is caused by the number of CPU processor bits)
Start re-configure GCC4.8 after 3 plug-ins are installed
Cheat 2:GCC configure Times wrong "configure: error: cannot compute suffix of object files: cannot compile."
Solution: vi/etc/profile
Add export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mpc-1.0.1/lib:/home/gmp-4.3.2/lib:/home/mpfr-3.1.3/lib
Then run # source / etc/profile (the problem is that the plug-in is not added to the environment variable after installation)
Configure GCC4.8 again
.. / gcc-4.8.2/configure-- enable-checking=release-- enable-languages=c,c++-- disable-multilib
Pit 3: still cannot find 3 plug-ins. An error prompts you to add the plug-in address manually and use the following command instead:
.. / configure-enable-checking=release-enable-languages=c,c++-disable-multilib-with-gmp=/home/gmp-4.3.2-with-mpfr=/home/mpfr-3.1.3-with-mpc=/home/mpc-1.0.1
After the configure is successful, compile
Make-J4
Make install
The word gcc version 4.8.2 (GCC) appears in the gcc-v view version after the compilation is successful, indicating that the installation is successful!
Thank you for reading this article carefully. I hope the article "how to install and compile gcc4.8" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!