在osx10.9mavericks上编译mesos时,如何修复“隐式示例化”错误?

jecbmhm3  于 2021-06-21  发布在  Mesos
关注(0)|答案(2)|浏览(343)

升级到OSX mavericks后,运行 make 在my mesos build目录中,将导致错误:

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;

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

iecba09b

iecba09b1#

OSX小牛取代了 gcc 叮当作响的命令:

$ gcc
clang: error: no input files

不过,mesos目前希望使用gnu编译器集合进行编译。您需要用自制软件安装GCC4.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

那你就可以跑了 make 像以前一样。

3npbholx

3npbholx2#

适用于那些在google搜索其他依赖于google旧版本的软件抛出的错误消息时发现此页面的用户 protobuf 图书馆,这里有另一个解决方案:
修改文件 src/google/protobuf/message.cc 再加一行 #include <iostream> 在开头的评论块之后,就在所有其他评论块之前 #include 线。这一行的改动就足够让我编译了 protocprotobuf-2.4.1 在el capitan mac上使用xcode 7.3中的命令行工具。

相关问题