Upgrade GCC version--rocksdb in MAC environment

Source: Internet
Author: User

Objective

Compiling rocksdb in a Mac environment requires configuring a dependent compilation environment, one of which is cumbersome: C + + compilation to support C++11, but after installing Xcode-select--install in a Mac environment, Already installed gcc-4.2.1, and not easy to upgrade, because there is already a/usr/bin/gcc, want to overwrite this command file is more troublesome.

OS X:install Latest C + + compiler that supports C + + 11:update Xcode:run xcode-select--install (or Install it from XCode A PP ' s settting). Install via homebrew. If you ' re first time developer on MacOS, you still need to run:xcode-select--install in your command line.run brew tap H Omebrew/versions; Brew Install gcc48--USE-LLVM to install GCC 4.8 (or higher). Run Brew Install Rocksdb

Upgrade gcc-4.9

Visit GCC official website you will find that the highest version of GCC is gcc-7.3, but in this article, we install gcc-4.9, if you need to install a higher version of GCC, in fact, the method is the same.

1. Check the GCC version that exists in the Homebrew library first

http://FORMULAE.BREW.SH/SEARCH/GCC

  

Will find the version has GCC, [email protected], [email protected], [email protected]

2. Install [email protected], this step is slow, wait patiently

Install gcc@4.9

3. Setting aliases

Edit ~/.ZSHRC, add the following code at the end

gcc="gcc-4.9"alias G++="g++-4.9"   cc="gcc-4.9"alias C++="c++-4.9 "

4. Close the console and reopen a console to view the GCC version

GCC -V

Upgrade GCC version--rocksdb in MAC environment

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.