CMU-Perceptual-Computing-Lab / openpose

OpenPose: Real-time multi-person keypoint detection library for body, face, hands, and foot estimation
https://cmu-perceptual-computing-lab.github.io/openpose
Other
31.36k stars 7.88k forks source link

Make fails because Protobuf seems not be using C++15 #2248

Open aljo opened 1 year ago

aljo commented 1 year ago

Issue Summary

I have issue with the compilation step. When running make -jsysctl -n hw.logicalcpu the compilation fails with Protobuf assertion stating that it only supports C++14 or newer. However the c++ version used is C++15

[75%] Performing build step for 'openpose_lib' [ 1%] Running C++/Python protocol buffer compiler on /Users/xyz/Projects/openpose/3rdparty/caffe/src/caffe/proto/caffe.proto [ 1%] Building CXX object src/caffe/CMakeFiles/caffeproto.dir///include/caffe/proto/caffe.pb.cc.o In file included from /Users/xyz/Projects/openpose/build/caffe/src/openpose_lib-build/include/caffe/proto/caffe.pb.cc:4: In file included from /Users/xyz/Projects/openpose/build/caffe/src/openpose_lib-build/include/caffe/proto/caffe.pb.h:11: /usr/local/include/google/protobuf/port_def.inc:210:1: error: static assertion failed due to requirement '201103L >= 201402L': Protobuf only supports C++14 and newer. static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer.");

Errors (if any)

[75%] Performing build step for 'openpose_lib' [ 1%] Running C++/Python protocol buffer compiler on /Users/xyz/Projects/openpose/3rdparty/caffe/src/caffe/proto/caffe.proto [ 1%] Building CXX object src/caffe/CMakeFiles/caffeproto.dir///include/caffe/proto/caffe.pb.cc.o In file included from /Users/xyz/Projects/openpose/build/caffe/src/openpose_lib-build/include/caffe/proto/caffe.pb.cc:4: In file included from /Users/xyz/Projects/openpose/build/caffe/src/openpose_lib-build/include/caffe/proto/caffe.pb.h:11: /usr/local/include/google/protobuf/port_def.inc:210:1: error: static assertion failed due to requirement '201103L >= 201402L': Protobuf only supports C++14 and newer. static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer.");

Type of Issue

Select the topic(s) on your post, delete the rest:

Your System Configuration

  1. Whole console output (if errors appeared), paste the error to PasteBin and then paste the link here: LINK

  2. OpenPose version: Latest GitHub code

  3. General configuration:

    • Installation mode: make -jsysctl -n hw.logicalcpu
    • Operating system
    • Operating system version x86_64-apple-darwin23.0.0
    • Release or Debug mode Release
    • Compiler Apple clang version 15.0.0 (clang-1500.0.40.1) Target: x86_64-apple-darwin23.0.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

protoc --version libprotoc 24.4

  1. Non-default settings:

    • 3-D Reconstruction module added no
    • Any other custom CMake configuration with respect to the default version? (by default: no): no
  2. 3rd-party software:

    • Caffe version: from openPose
    • CMake version cmake version 3.27.7
    • OpenCV version: pre-compiled apt-get install libopencv-dev (only Ubuntu); OpenPose default (only Windows); compiled from source? If so, 2.4.9, 2.4.12, 3.1, 3.2?; ...?
aljo commented 1 year ago

Based on the following post I updated openpose/3rdparty/caffe/CMakeLists.txt to

# ---[ Flags
if(UNIX OR APPLE)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -std=c++17")
endif()

This seems to have resolved the protobuf issue, but I am now running into another problem:

io.cpp:57:57: error: too many arguments to function call, expected single argument 'total_bytes_limit', have 2 arguments coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);


/usr/local/include/google/protobuf/io/coded_stream.h:390:8: note: 'SetTotalBytesLimit' declared here
  void SetTotalBytesLimit(int total_bytes_limit);
       ^
1 error generated.
rosxnb commented 10 months ago

Hey, did you manage to solve the issue? If not,

  1. go to file path cd <openpose-root-dir>/3rdparty/caffe/src/caffe/util
  2. open file that contains error in an editor: vim io.cpp
  3. change coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912); to coded_input->SetTotalBytesLimit(kProtoReadBytesLimit); at line 57

after following these steps, go back to build dir and re-run the make command.