Centos6_64 GCC-C ++ Platform Construction

Source: Internet
Author: User

Centos6_64 GCC-C ++ Platform Construction
Automatic Installation

Yum install gcc (this is) yum install gcc-c ++ (this is the C ++ compiler) yum install cmake

However, in this case, you cannot install the specified version only on the system disk. The following uses centos 6X64 to install gcc 4.8.4 as an example.

Custom installation 1. Install gcc4.8.4for (I am actually one)

The following cd XX indicates entering a directory under the root directory by default.
Cd .. or ''indicates returning to the root directory
Wget indicates obtaining a download from the Network Location

1) download source code
Wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.4/gcc-4.8.4.tar.bz2 (you can change the version number here as needed)
2) decompress and download the project required for compilation.
Tar-jxvf gcc-4.8.4.tar.bz2cd gcc-4.8.4./contrib/download_prerequisites cd .. (return to the root directory here. can be replaced by space)
3) generate directory and makefile and compile
Mkdir gcc-build-4.8.4 (create a directory under root to store) cd gcc-build-4.8.4 .. /gcc-4.8.4/configure -- enable-checking = release -- enable-versions ages = c, c ++ -- disable-multilibmake-j4 (* this step is a long wait ~ Don't think it's a crash .....*)
4) Installation
sudo make install
5) Check the version number
gcc --version or -v
Using built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.8.4/lto-wrapperTarget: x86_64-unknown-linux-gnuConfigured with: ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilibThread model: posixgcc version 4.8.4 (GCC)
2. Install Cmake1) obtain the source as above
Wget http://www.cmake.org/files/v3.4.2/cmake-3.4.2.tar.gz (updated to 3.5 now, depending on your needs, this version is relatively stable)
2) decompress and enter the Directory
tar -zxvf cmake-3.4.2.tar.gzcd cmake-3.4.2
3) Important and easy to report errors
./bootstrap
Error 1
Gmake: "cmake" is the latest. /Home/src/cmake-2.8.12.2/Bootstrap. cmk/cmake:/usr/lib64/libstdc ++. so.6: version 'glibcxx _ 3.4.15 'not found (required by/home/src/cmake-2.8.12.2/Bootstrap. cmk/cmake) Try to run strings/usr/lib/libstdc ++. so.6 | grep GLIBCXX GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 using GLIBCXX_3.4.5 using GLIBCXX_3.4.7 without using GLIBCXX_3.4.12 using libstdc ++. due to earlier so.6 versions
Obtain from Network
Wget http://ftp.de.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6_4.7.2-5_i386.deb (get as needed) tar-x libstdc ++ 6_4.7.2-5_i386.deb & tar xvf data.tar.gz
Starting with the gcc just installed
Follow the gcc installation path and find the new libstdc ++: strings/usr/local/lib64/libstdc ++. so.6.0.20 | grep GLIBCXX (6. later) depends on the version.

Good. There's something that fits the requirements.

Combine the first two methods
Cp/usr/local/lib/libstdc ++. so.6.0.20/usr/lib/(copy to usr directory) cd/usr/lib/(to this directory) rm-f libstdc ++. so.6 (delete old lib) ln-s libstdc ++. so.6.0.20 libstdc ++. so.6 (re-establish the link) strings/usr/lib/libstdc ++. so.6 | grep GLIBCXX (view again)

Note that the directory under lib64 must also be updated! I will not repeat the suffix here.

Error 2
Error when bootstrapping CMake: Cannot find appropriate C (or C ++) compiler on this system. Please specify one using environment variable CC. See cmake_bootstrap.log for compilers attempted.

The appropriate C/C ++ compiler is missing. Check whether the gcc version matches. In this example, it should be matched !~

4) subsequent installation
gmakegmake installcmake --version
3. Verify
// Fir. cc # include <iostream> using namespace std; int main () {cout <"Hello world! "<Endl; return 0;} input g ++-std = c ++ 11-o fir in cmd. cc. /fir. cc. cc)

Related Article

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.