Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you fix "implicit instantiation" errors when compiling Mesos on OS X 10.9 Mavericks?

After upgrading to OS X Mavericks, running make in my Mesos build directory results in errors:

google/protobuf/message.cc:130:60: error: implicit instantiation of undefined template 'std::__1::basic_istream<char, std::__1::char_traits<char> >'
  return ParseFromZeroCopyStream(&zero_copy_input) && input->eof();
                                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:108:28: note: template is declared here
    class _LIBCPP_TYPE_VIS basic_istream;
                           ^
google/protobuf/message.cc:135:67: error: implicit instantiation of undefined template 'std::__1::basic_istream<char, std::__1::char_traits<char> >'
  return ParsePartialFromZeroCopyStream(&zero_copy_input) && input->eof();
                                                                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:108:28: note: template is declared here
    class _LIBCPP_TYPE_VIS basic_istream;
                           ^
google/protobuf/message.cc:175:16: error: implicit instantiation of undefined template 'std::__1::basic_ostream<char, std::__1::char_traits<char> >'
  return output->good();
               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:110:28: note: template is declared here
    class _LIBCPP_TYPE_VIS basic_ostream;

I started with a clean build directory, re-ran ./bootstrap, and ran cd build && ../configure.

like image 225
Ross Allen Avatar asked Nov 27 '22 17:11

Ross Allen


2 Answers

For people who find this page while Googling error messages thrown up by some other software that depends on old versions of Google's protobuf libraries, here's another solution:

Modify the file src/google/protobuf/message.cc and add the line #include <iostream> after the opening comment block, right before all the rest of the #include lines. That one-line change was enough to enable me to compile protoc from protobuf-2.4.1 with the command-line tools from XCode 7.3 on an El Capitan Mac.

like image 103
Daniel Martin Avatar answered Dec 31 '22 01:12

Daniel Martin


OS X Mavericks replaced the gcc command with clang:

$ gcc
clang: error: no input files

However, Mesos currently expects to be compiled with the GNU Compiler Collection. You need to install GCC 4.7 with Homebrew and configure your build directory to use it. To be sure, start with an empty build directory:

# Install GCC 4.7
brew tap homebrew/versions
brew install gcc47

# Configure Mesos build to use GCC
cd /path/to/mesos
rm -rf build
mkdir build
cd build
CC=gcc-4.7 CXX=g++-4.7 ../configure

Then you can run make like before.

like image 23
Ross Allen Avatar answered Dec 31 '22 00:12

Ross Allen