Compile and install GCC 4.8.1 + GDB 7.6.1 + Eclipse in CentOS 6.4

Source: Internet
Author: User
Tags install window

Compile and install GCC 4.8.1 + GDB 7.6.1 + Eclipse in CentOS 6.4

Compile and install GCC 4.8.1 + GDB 7.6.1 + Eclipse in CentOS 6.4

1. Compile and install gcc 4.8.1

1. Install gcc and g ++

The newly installed CentOS does not have a compilation environment. You must first install the old version of gcc and then perform self-compilation.

Yum-y install gcc
Yum-y install gcc-c ++

2. Download the gcc 4.8.1 source code package

Http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.8.1/gcc-4.8.1.tar.gz

Place the source code package in the Download directory of the home directory.

3. decompress the gcc 4.8.1 source code package

Cd/root/Downloads/

Tar-zxvf gcc-4.8.1.tar.gz

4. Download the dependent packages required for compilation

Cd/root/Downloads/gcc-4.8.1

./Contrib/download_prerequisites

Cd ..

5. Create a directory to store compilation results

Mkdir gcc-build-4.8.1

6. Enter the new directory and run the configure command to generate the makefile

Cd gcc-build-4.8.1
../Gcc-4.8.1/configure -- enable-checking = release -- enable-packages ages = c, c ++ -- disable-multilib

7. Compile gcc 4.8.1

Make-j4

8. Install gcc 4.8.1

Sudo make install

9. Update libstdc ++. so.6

Sudo cp/root/Downloads/gcc-build-4.8.1/prev-x86_64-unknown-linux-gnu/libstdc ++-v3/src/. libs/libstdc ++. so.6.0.18/usr/lib
Sudo ln-sf/usr/lib/libstdc ++. so.6.0.18/usr/lib/libstdc ++. so.6

The red part varies on different platforms. Note that if it is a 64-bit system, replace lib with lib64 in the command.

10. Check the version

G ++ -- version

G ++ (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
Warranty; not even for MERCHANTABILITY or fitness for a particle PURPOSE.

Gcc -- version

Gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
Warranty; not even for MERCHANTABILITY or fitness for a particle PURPOSE.

2. Compile and install gdb 7.6.1

1. Uninstall the old version of gdb first.

Rpm-qa | grep gdb

Rpm-e -- nodeps gdb-7.2-60.el6_4.1.i686

 

2. Install the Texinfo Document System

Yum install ncurses-devel

 

3. Download the source code package of gdb 7.6.1.

Http://ftp.gnu.org/gnu/gdb/gdb-7.6.1.tar.gz

Place the source code package in the Download directory of the home directory.

4. decompress the source code package of gdb 7.6.1.

Cd/root/Downloads/

Tar-zxvf gdb-7.6.1.tar.gz

5. Generate makefile

Cd/root/Downloads/gdb-7.6.1

./Configure

Make

Sudo make install

6. Copy the compiled gdb file to the/usr/bin directory.
Sudo cp/root/Downloads/gdb-7.6.1/gdb/usr/bin/gdb
7. Check whether the installation is successful.
Gdb-v

3. Install Eclipse

1. Download Eclipse IDE for C/C ++ Developers

Cd/root/Downloads

Wget http://mirror.hust.edu.cn/eclipse//technology/epp/downloads/release/luna/R/eclipse-cpp-luna-R-linux-gtk-x86_64.tar.gz

2. decompress and install Eclipse

Tar xvzf eclipse-cpp-luna-R-linux-gtk-x86_64.tar.gz

Mv/root/Downloads/eclipse/usr/local/Eclipse4C

Rm-rf eclipse-cpp-luna-R-linux-gtk-x86_64.tar.gz

3. Create a desktop shortcut

Right-click the system desktop, select "Create Launcher..." in the pop-up menu, and set as follows:

The Command parameter is/usr/local/Eclipse4C/eclipse. Click OK to create a shortcut on the desktop.

4. Set Workspace

Mkdir-p/home/Workspace/C

Double-click the Eclipse4C shortcut on the desktop and set the Workspace directory to/home/Workspace/C, as shown in:

5. Install the ShellED plug-in

On the Eclipse menu bar, find Help → Install New Software..., open the Install window, and configure it, as shown in:

Check Shell Script and click Next.

The download link for ShellED is: http://sourceforge.net/projects/shelled/files/shelled/update/

6. Add ShellED support for the C/C ++ Project

Right-click the project name and choose ShellED> Add Shell Script Support from the shortcut menu.

After the preceding settings, Eclipse can run Shell scripts in the C/C ++ project.

Introduction to GCC compiler

Ubuntu 12.04 embedded cross-compilation environment arm-linux-GCC Build Process Diagram

Install the cross-compiler arm-none-linux-gnueabi-GCC in Ubuntu 12.10

Install and use Vim + GCC + GDB in Ubuntu

Switch two GCC versions in Ubuntu

GCC details: click here
GCC: click here

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.