Install GCC source code-general Linux technology-Linux programming and kernel information. For more information, see the following. This morning on the machine, the task is to be familiar with source code software installation in linux, our purpose is to install GCC4.1.1 in the source code method.
This stuff has been installed before. I checked and installed it on the Internet. I can use it after installation, and I have not summarized it. I would like to summarize the results today for future use.
First of all, it is the source code, export-xvjf gcc-4.1.1.tar.bz2. By default will generate a gcc-4.1.1 directory. Find the installation process and open index.html under the installfolder. It is only in English and can be divided into five steps. The first is to install the required tool. Well, I didn't see it. My principle is to install it directly, and there is nothing to install (I found that almost everything can be done with yum install, however, if this is the case, you will not be able to know what you have actually done.) Here, we will only talk about the main process of installing gcc. Other things will be mentioned later.
2. Create a folder before configuring. One is used to store temporary files for temporary compilation. If this is not required, it will be generated in the source file. This is not good. Generally, it will not generate intermediate compilation results in the source file. I created a gcc-build at the same level as the source code folder. Mkdir gcc-build. The other is the target folder to which your GCC will be installed. It puts the generated stuff here after make install. It will be found in this folder if it is used later. In/usr/local, makedir gcc4.1.1. Then go to gcc-build to start configuration.
.. /Gcc-4.1.1/configure -- prefix =/usr/local/gcc4.1.1 -- enable-threads -- disable-checking -- enable -- long -- host = i386-redhat-linux -- with-system-zlib -- enable- ages = c, c ++. You just need to configure it as needed.
If it succeeds, no error will occur after the check.
Step 3: make. If you want to hurry up, you can add-jn. You mean to compile several threads at the same time. This process is very long. It took me more than an hour to complete it. Fortunately, no error was reported. My classmates had a longer time than me, and the result was under my curse, two errors occurred, causing a complete crash. The morning's hard work was in vain.
Fourth: make install
Fifth: to use GCC 4.1.1 or other commands, the simple method is to put its installation PATH/bin in the environment variable PATH. You do not need to use this method. Instead, you can use the old version of GCC compiler on the system.
First, check the original gcc path which gcc. The preceding command shows:/usr/bin/gcc. Therefore:
In this way, gcc4 and g ++ 4 can be used to call GCC respectively, while gcj4 can call gcj. The original gcc, g ++, and gcj are still in the original version.
Finally, set the library path.
Add the/usr/local/gcc4.1.1/lib path to the environment variable LD_LIBRARY_PATH. It is best to add it to the system configuration file, so you do not need to set this environment variable every time. in RH Linux, you can directly execute the command line or Add the following sentence to the file/etc/profile:
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