I found an old RedHatlinux and wanted to install apache + tomcat. Because it is running in a virtual machine, I want to first install a vmware-tools to improve performance. However, during the installation process, I found that gcc could not be found. So I downloaded a gcc installation package online (gcc.gnu.org. However, this installation encountered various troubles and I was not good at using linux, So I recorded the problems after the installation was successful. For the installation method, see [GCC installation method under Linux] find an old RedHatlinux and want to install apache + tomcat. Because it is running in a virtual machine, I want to first install a vmware-tools to improve performance.
However, during the installation process, I found that gcc could not be found. So I went online (Gcc.Gnu.org) Download a gcc to prepare for installation. However, this installation encountered various troubles and I was not good at using linux, So I recorded the problems after the installation was successful. For the installation method, see [GCC installation method under Linux] http://www.linuxidc.com/Linux/2009-01/18242.htm and http://www.linuxidc.com/Linux/2008-05/13063.htm
1. Install gcc, but the prompt is that gcc cannot be found, and thus gcc cannot be installed.
After the gcc is downloaded, useTar-xjf gcc-4.4.5.tar.bz2Unzip to the gcc-4.4.5 directory
After cd gcc-4.4.5Configure -- prefix =/usr/local/gccobjdirError
Checking build system type... i686-pc-linux-gnu
Checking host system type... i686-pc-linux-gnu
Checking target system type... i686-pc-linux-gnu
Checking for a BSD-compatible install.../usr/bin/install-c
Checking whether ln works... yes
Checking whether ln-s works... yes
Checking for a sed that does not truncate output.../bin/sed
Checking for gawk... gawk
Checking for gcc... no
Checking for cc... no
Checking for cl.exe... no
Configure: error: in '/root ':
Configure: error: no acceptable C compiler found in $ PATH
See 'config. log' for more details.
The gcc compiling environment cannot be found during gcc installation. So I went to the/usr/bin directory,Ls | grep gccCheck whether gcc exists and see a gcc264 file (you cannot remember the specific number ). It is suspected that the file is gcc, soCp gcc264 gcc, Copy one copy and thenGcc-vView the version information. The digit that follows is the version.
Then execute againConfigure -- prefix =/usr/local/gccobjdirThe preceding error disappears, but a new error occurs.
2. the gmp and mpfr libraries are missing.
To continue running the configure command, the prompt is as follows:
Gcc configure: error: Building GCC requires GMP 4.2 +, MPFR 2.3.1 + and MCM 0.8.0 +
Note: To install gcc, you need to install the GMP, MPFR, and MPC libraries. You can download the corresponding compressed packages from ftp://gcc.gnu.org/pub/gcc/infrastructure. Since MPFR depends on GMP, while nmms depends on GMP and MPFR, it is necessary to install GMP first, followed by MPFR, and finally the nmms. Here, the three libraries are available in gmp4.3.2, mpfr2.4.2, and mpc0.8.1.
Install GMP first. Decompress the GMP compressed package, get the source code directory gmp-4.3.2. Create a temporary compilation directory under the directory of the same level. Name it gmp-build. Then, configure the installation options, go to the gmp-build directory, and enter the following command for Configuration:
../Gmp-4.3.2/configure -- prefix =/usr/local/gmp-4.3.2
Here the -- prefix option indicates where the library is to be installed, and I install it in the/usr/local/gmp-4.3.2 Directory, which will be used in subsequent installations.
At this time, a makefile file will be generated under the gmp compilation directory, and compilation and installation will begin now.
Make
Make check
Sudo make install
In this way, the gmp has been installed. The method for installing mpfr and nmpc is similar. Note that the dependency option should be added during configuration. The configuration commands for the following two libraries are as follows:
../Mpfr-2.4.2/configure -- prefix =/usr/local/mpfr-2.4.2 -- with-gmp =/usr/local/gmp-4.3.2
../Mpc-0.8.1/configure -- prefix =/usr/local/mpc-0.8.1 -- with-gmp =/usr/local/gmp-4.3.2 -- with-mpfr =/usr/local/mpfr-2.4.2
After the three libraries are installed, continue to runConfigure -- prefix =/usr/local/gccobjdirCommand to finally configure gcc.
3. make compilation is not allowed after gcc is configured.
EnterMakeCommand to compile the source code, but the prompt is that the make version is too low. I checked the make-v version as 3.79 or later, and then downloaded a make command (note, google search can be used instead of Baidu search .)
Install Make
Prepare for compiling Make:
./Configure -- prefix =/usr
Compile the software package:
Make
Installation package:
Make install
After the make installation is complete, go to the directory where the configure command was just executed and continue to make. In this case, the compilation is successful. (Compilation is too slow), waiting