Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save icejoywoo/5de860bcd8a0fb7a0afe304cd73dd5d4 to your computer and use it in GitHub Desktop.
Save icejoywoo/5de860bcd8a0fb7a0afe304cd73dd5d4 to your computer and use it in GitHub Desktop.
Steps to Install google protobuf on Mac
# version 2.5.0
$wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2
$tar xvf protobuf-2.5.0.tar.bz2
$cd protobuf-2.5.0
$./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
$make -j 4
$sudo make install
$protoc --version
# version 2.4.1
# with -std=c++11 may encounter error:
# google/protobuf/compiler/command_line_interface.cc:913:29: error: no matching function for call to 'make_pair'
$wget https://github.com/google/protobuf/releases/download/v2.4.1/protobuf-2.4.1.tar.bz2
$tar xvf protobuf-2.5.0.tar.bz2
$cd protobuf-2.5.0
$./configure CC=clang CXX=clang++ CXXFLAGS='-stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
$make -j 4
$sudo make install
$protoc --version
@icejoywoo
Copy link
Author

icejoywoo commented Aug 21, 2019

Maybe encounter error like this when make version 2.4.1 :

google/protobuf/message.cc:130:60: error: implicit instantiation of undefined template 'std::__1::basic_istream<char, std::__1::char_traits<char> >'

Then, you can add header #include <istream> in the beginning of src/google/protobuf/message.cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment