Home System Tutorial LINUX Detailed explanation of compiling and installing GCC under CentOS6.8

Detailed explanation of compiling and installing GCC under CentOS6.8

Jan 07, 2024 pm 04:21 PM
gcc Compile and install

About the default version number of GCC installed through yum under CentOS, CentOS 5 is 4.1.2; CentOS 6 is 4.4.7; CentOS 7 is 4.8.3.

Many times when compiling and installing software, a higher version of GCC is required, otherwise an error will be reported.

So how to upgrade the GCC version?

First, confirm the GCC version number you upgraded to.

Currently, the latest version of GCC has reached 5.2, while CentOS 7 still uses 4.8, so based on compatibility considerations, I chose to upgrade to 4.8.5.

GCC official website: https://www.php.cn/link/421f8eb2f6d635fc5e09d0b16c59e281

Let’s start step by step to compile and install GCC 4.8.5. It should be noted that before compiling and installing GCC, the old version of GCC and dependent libraries must be installed in the system through yum.

If you are compiling under an x86_64 system, you also need to install libgcc.i686 glibc-devel.i686.

yum install -y gcc texinfo-tex flex zip libgcc.i686 glibc-devel.i686

Note: When compiling and installing GCC, the memory must be no less than 1GB, Swap must be no less than 1GB, and the hard disk must be no less than 10GB. Otherwise, it is very likely to exit with an error midway.

After compilation and installation, the directory gcc-4.8.5 will be 5GB.

1. Download source code

wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.gz

2. Download dependency packages

Compiling and installing GCC requires dependencies on mpc, mpfr, and gmp packages. Fortunately, the GCC source code comes with a script that can easily download dependency packages.

tar zxf gcc-4.8.5.tar.gz cd gcc-4.8.5 ./contrib/download_prerequisites

Detailed explanation of compiling and installing GCC under CentOS6.8

Detailed explanation of compiling and installing GCC under CentOS6.8

Detailed explanation of compiling and installing GCC under CentOS6.8

Compile and install

# cd gcc-4.8.1

#./gcc-4.8.1/configure--prefix=/usr/local/gcc-4.8.1 --enable-languages=c,c

prefix=/usr/local/gcc-4.8.1 indicates the path to configure the installation. If the installation path is not specified, the executable file will be placed under /usr/local/bin by default. This is done to facilitate maintenance. When needed When uninstalling, just delete the directory directly.

enable-languages ​​means installation language, here it means only c and c

Compile

After the preparation is completed, you can compile

# make

This process takes about 2 hours. If an error is reported midway, it will prompt fatal error: gnu/stubs-32, No such file or directory. As shown below:

Detailed explanation of compiling and installing GCC under CentOS6.8

Run the following command and then recompile

# yum -y install glibc-devel.i686 --setopt=protected_multilib=false

# make

The above is the detailed content of Detailed explanation of compiling and installing GCC under CentOS6.8. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Recommend five popular C language compilers Recommend five popular C language compilers Feb 19, 2024 pm 02:05 PM

Choosing a C Compiler: Five Most Popular Recommendations, Specific Code Examples Needed Introduction: C is a high-level programming language widely used in system development and embedded device programming. Whether you are a beginner or an experienced programmer, choosing the right C compiler is crucial. This article will introduce the five most popular C language compilers and provide specific code examples to help readers choose the compiler that suits their needs. 1. GCC compiler: GCC (GNUCompilerCollection

Detailed guide to installing GCC and GCC10 on Debian Detailed guide to installing GCC and GCC10 on Debian Feb 10, 2024 pm 03:57 PM

Debian is a popular Linux distribution, widely used in servers and desktop systems. GCC (GNUCompilerCollection) is an open source compiler suite used to compile C, C++, Fortran and other programming languages. In the Debian system, Installing GCC and GCC10 is very simple. This article will provide you with a detailed installation guide. Install GCC1. Open Terminal and use the following command to update the package list: ```shellsudoaptupdate``` 2. Install GCC and its related tools: sudoaptinstallbuild-essential This command will install

Detailed explanation of the steps to upgrade gcc using yum on CentOS6.5 Detailed explanation of the steps to upgrade gcc using yum on CentOS6.5 Dec 31, 2023 am 10:59 AM

Because C++11 needs to be used, but the gcc4.4.7 that comes with CentOS does not support it, I decided to upgrade gcc. The operation is as follows: #Backup mv/etc/yum.repos.d/devtools-2.repo/etc/yum.repos.d/devtools-2.repo.bakwgethttp://people.centos.org/tru/devtools-2 /devtools-2.repo-O/etc/yum.repos.d/devtools-2.repoyuminstalldevtoolset-2-gccdevtoolse

Detailed explanation of compiling and installing GCC under CentOS6.8 Detailed explanation of compiling and installing GCC under CentOS6.8 Jan 07, 2024 pm 04:21 PM

Regarding the default version number of GCC installed through yum under CentOS, CentOS5 is 4.1.2; CentOS6 is 4.4.7; CentOS7 is 4.8.3. Many times, a higher version of GCC is required when compiling and installing software, otherwise an error will be reported. So how to upgrade the GCC version? First, confirm the GCC version number you upgraded to. At present, the latest version of GCC has reached 5.2, and CentOS7 still uses its 4.8, so based on compatibility considerations, I chose to upgrade to 4.8.5. GCC official website: https://gcc.gnu.org Let’s start step by step to compile and install GCC4.8.5. It should be noted that before compiling and installing GCC, the system

Detailed tutorial on installing gcc on Linux system. Detailed tutorial on installing gcc on Linux system. Feb 19, 2024 am 11:18 AM

Here is a detailed tutorial for installing GCC (GNUCompilerCollection) on Linux systems: Update package list: Execute the following command in the terminal to ensure that the package list of your system is up to date: sudoaptupdate Install GCC: Continue executing the following in the terminal Command to install GCC and its related tools: sudoaptinstallbuild-essentialbuild-essential is a package that contains GCC and other build tools that will meet most basic compilation needs. Verify installation: Once the installation is complete, you can verify that GCC was installed successfully. Execute the following command in the terminal to check the version of GCC

What does gcc mean? What does gcc mean? Jan 29, 2023 pm 03:18 PM

gcc has many meanings: 1. The GNU compiler suite is a programming language compiler developed by GNU, including C, C++, Objective-C, Fortran, Java, Ada and Go language front-ends, as well as libraries for these languages. 2. The political and economic organization in the Gulf region, namely the Gulf Cooperation Council, referred to as the Gulf Cooperation Council or the GCC, was established in May 1981 and is headquartered in Riyadh, the capital of Saudi Arabia. 3. The Global Entrepreneurship Week Campus Center is a college student organization that brings together entrepreneurial enthusiasts.

How to debug C++ code using GCC static analyzer? How to debug C++ code using GCC static analyzer? Jun 03, 2024 pm 02:51 PM

The GCC static analyzer debugs C++ code by detecting potential errors and security issues at compile time. The usage steps are as follows: Install the GCC static analyzer. Compile the code using -fanalyzer. Parse results in JSON, XML, or line-by-line warning lists. Practical example: Preventing crashes and security vulnerabilities by detecting array out-of-bounds.

Recommended configuration for embedded ARM assembly using GCC under Linux Recommended configuration for embedded ARM assembly using GCC under Linux Jul 04, 2023 am 10:13 AM

Recommended configuration for using GCC for embedded ARM assembly under Linux. One of the commonly used processor architectures in embedded systems is the ARM architecture, and Linux is an operating system widely used in embedded system development. Using GCC for embedded ARM assembly under Linux can facilitate development work. This article will introduce how to configure GCC and provide some code examples. Install the GCC toolchain First, we need to install the GCC toolchain. The GCC tool chain is a collection of GCC compilers for a specific platform.

See all articles