Use the source package to compile the installation under Mac OS X 10.10.3 GCC5.1

Source: Internet
Author: User

1. First go to download gcc5.1 Source package: https://gcc.gnu.org/

2. Installation:

./configure (can be set up here to install the directory, all files are stored in a directory, later whether it is to find or delete is very convenient, eg: my location:./configure–-prefix=/usr/local/gcc5.1_source)

Gcc5.1_source This directory needs to be built in advance.

Make (it takes about 4 hours)

Make install

The 3.MAC comes with a system that uses GCC as a soft link clang compiler instead of true GCC, using the following command to see:

Ls-al $ (dirname $ (which gcc)) | grep ' gcc\|g++\|c++ '


Enter/usr/bin/to remove all old commands, because these commands are the old version of the command link:
1. Switch root account: sudo su-
2. RM/USR/BIN/GCC
rm/usr/bin/g++
Rm/usr/bin/c++
Rm/usr/bin/cpp
rm/usr/bin/cc

3. Enter/usr/local/gcc5.1_source/bin

Directory to see if the following executable programs are available:
/usr/local/gcc5.1_source/bin GCC

/usr/local/gcc5.1_source/bin g++

/usr/local/gcc5.1_source/bin C + +

/usr/local/gcc5.1_source/bin cc

4. Enter the Usr/bin directory and add a soft link:

LN–S/USR/LOCAL/GCC5.1_SOURCE/BIN/GCC GCC

ln–s/usr/local/gcc5.1_source/bin/g++ g++

Ln–s/usr/local/gcc5.1_source/bin/c++ C + +

LN–S/USR/LOCAL/GCC5.1_SOURCE/BIN/CC cc



4. Use the root account to open/etc/profile This configuration file with VI (VIM) and add the gcc5.1 library file path:

1. Switch the root account.
2.vim/etc/profile

3. Add these two sentences under path:
/usr/local/gcc5.1_source/lib

/usr/local/gcc5.1_source/bin

My path is this:
Export path=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/bin:/usr/x11/bin:/a.out/bin:/usr/local/cellar/mariadb/ 10.0.17/bin/mysql/bin:/usr/local/cellar/mariadb/10.0.17/bin/mysqld/bin:/usr/local/gcc5.1_source/bin/bin:/usr/ Local/gcc5.1_source/lib/bin:

5. Then Source/etc/profile.
6. Review and compile the. c/.cpp file to finish.

Use the source package to compile the installation under Mac OS X 10.10.3 GCC5.1

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.