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