在OS X 10.9 Mavericks上编译Mesos时,如何修复"隐式实例化"错误?

Ros*_*len 3 gcc osx-mavericks mesos

升级到OS X Mavericks后,make在我的Mesos构建目录中运行会导致错误:

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;
Run Code Online (Sandbox Code Playgroud)

我从一个干净的构建目录开始,重新运行./bootstrap并运行cd build && ../configure.

Dan*_*tin 16

对于在Googling错误消息中找到此页面的人,这些错误消息是由依赖于旧版Google protobuf库的其他软件引发的,这是另一种解决方案:

修改文件src/google/protobuf/message.cc#include <iostream>在打开注释块之后添加该行,就在所有其余#include行之前.那一个线的变化就足以使我编译protocprotobuf-2.4.1与在Xcode 7.3的埃尔卡皮坦Mac上的命令行工具.


Ros*_*len 9

OS X Mavericks gccclang替换了命令:

$ gcc
clang: error: no input files
Run Code Online (Sandbox Code Playgroud)

但是,Mesos目前希望使用GNU Compiler Collection进行编译.您需要使用Homebrew安装GCC 4.7并配置您的构建目录以使用它.可以肯定的是,从一个空的构建目录开始:

# 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
Run Code Online (Sandbox Code Playgroud)

然后你可以make像以前一样跑.