Detailed explanation of compiling and installing GCC under CentOS6.8
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
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:
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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

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

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

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

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

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.

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 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.
