Solvedopenpose macOS - protobuf compilation errors

Steps to reproduce

  • Clone repo
  • bash 3rdparty/osx/install_deps.sh
  • mkdir build
  • cd build
  • cmake-gui (configure and generate with the non default settings below)
  • sudo make inside the build directory fails due to protobuf errors.

Type of Issue

  • Compilation/installation error

Your System Configuration

  • macOS High Sierra 10.13.4
  • MacBook Pro (Retina, 13-inch, Early 2015)
  • Processor: 2.7 GHz Intel Core i5
  • RAM: 16 GB 1867 MHz DDR3

Non-default settings

  • GPU_MODE=CPU_ONLY and WITH_EIGEN=BUILD

Using commit c8e3879

Description

Compilation fails on mac with numerous errors in the protobuf lib:

In file included from /usr/local/include/google/protobuf/wire_format_lite_inl.h:43:
/usr/local/include/google/protobuf/message_lite.h:117:3: error: unknown type name 'constexpr'
  constexpr const T& get() const { return reinterpret_cast<const T&>(union_); }
  ^
/usr/local/include/google/protobuf/message_lite.h:117:13: error: expected member name or ';' after declaration specifiers
  constexpr const T& get() const { return reinterpret_cast<const T&>(union_); }
  ~~~~~~~~~ ^
/usr/local/include/google/protobuf/message_lite.h:110:11: error: use of undeclared identifier 'union_'
    new (&union_) T();
          ^
/usr/local/include/google/protobuf/message_lite.h:114:5: error: use of undeclared identifier 'get_mutable'
    get_mutable()->~T();
    ^
/usr/local/include/google/protobuf/message_lite.h:131:48: error: found '<::' after a template name which forms the digraph '<:'
      (aka '[') and a ':', did you mean '< ::'?
In file included from /usr/local/include/google/protobuf/wire_format_lite_inl.h:44:
/usr/local/include/google/protobuf/repeated_field.h:123:39: error: expected ';' at end of declaration list
  RepeatedField(RepeatedField&& other) noexcept;
                                      ^
/usr/local/include/google/protobuf/repeated_field.h:124:50: error: expected ';' at end of declaration list
  RepeatedField& operator=(RepeatedField&& other) noexcept;
                                                 ^
/usr/local/include/google/protobuf/repeated_field.h:778:45: error: expected ';' at end of declaration list
  RepeatedPtrField(RepeatedPtrField&& other) noexcept;
                                            ^
/usr/local/include/google/protobuf/repeated_field.h:779:56: error: expected ';' at end of declaration list
  RepeatedPtrField& operator=(RepeatedPtrField&& other) noexcept;
                                                       ^
/usr/local/include/google/protobuf/repeated_field.h:1090:68: error: expected ';' at end of declaration
inline RepeatedField<Element>::RepeatedField(RepeatedField&& other) noexcept
                                                                   ^
/usr/local/include/google/protobuf/repeated_field.h:1090:69: error: unknown type name 'noexcept'
inline RepeatedField<Element>::RepeatedField(RepeatedField&& other) noexcept
                                                                    ^
/usr/local/include/google/protobuf/repeated_field.h:1091:5: error: expected unqualified-id
    : RepeatedField() {
    ^
/usr/local/include/google/protobuf/repeated_field.h:1103:27: error: expected ';' at end of declaration
    RepeatedField&& other) noexcept {
                          ^
/usr/local/include/google/protobuf/repeated_field.h:1103:28: error: C++ requires a type specifier for all declarations
    RepeatedField&& other) noexcept {
                           ^
/usr/local/include/google/protobuf/repeated_field.h:1103:36: error: expected ';' after top level declarator
    RepeatedField&& other) noexcept {
                                   ^
/usr/local/include/google/protobuf/repeated_field.h:1928:30: error: expected ';' at end of declaration
    RepeatedPtrField&& other) noexcept
                             ^
/usr/local/include/google/protobuf/repeated_field.h:1928:31: error: unknown type name 'noexcept'
    RepeatedPtrField&& other) noexcept
                              ^
/usr/local/include/google/protobuf/repeated_field.h:1929:5: error: expected unqualified-id
    : RepeatedPtrField() {
    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
31 Answers

βœ”οΈAccepted Answer

@soulslicer installing Caffe separately and setting BUILD_CAFFE to false in the cmake config seems to have done the trick πŸ˜„. Here are the steps I used to fix my build:

  • Remove the build folder
  • brew uninstall caffe to remove the version of Caffe previously installed via cmake.
  • brew install caffe to install Caffe separately
  • mkdir build; cd build
  • cmake-gui
  • Make the following adjustments to the cmake config:
    1. BUILD_CAFFE set to false
    2. GPU_MODE set to CPU_ONLY (as recommended for MacOS)
    3. Caffe_INCLUDE_DIRS set to /usr/local/include/caffe
    4. Caffe_LIBS set to /usr/local/lib/libcaffe.dylib

screen shot 2018-06-26 at 9 25 57 pm

@takaya1219 I tried downgrading protobuf to v3.5.1 before implementing the above changes, and that did not fix the build for me.

Other Answers:

@codyrushing Could you try installing Caffe from its official website, and then simply disable BUILD_CAFFE in OpenPose CMake? (So OpenPose will ask you for the path where you have your Caffe). Thanks

More Issues: