I am currently trying to build OpenPose. First, I will try to describe the environment and then the error emerging from it. Caffe, being built from source, resides in its entirety in [/Users...]/openpose/3rdparty instead of the usual location (I redact some parts of the filepaths in this post for privacy). All of its include files can be found in [/Users...]/openpose/3rdparty/caffe/include/caffe. After entering this command:
make -j`sysctl -n hw.logicalcpu` CXXFLAGS=-I[/Users/..]/openpose/3rdparty/caffe/include
This error followed:
[ 0%] Building CXX object src/openpose/CMakeFiles/openpose.dir/core/arrayCpuGpu.cpp.o
[ 1%] Building CXX object src/openpose/CMakeFiles/openpose.dir/face/faceExtractorCaffe.cpp.o
[ 1%] Building CXX object src/openpose/CMakeFiles/openpose.dir/hand/handExtractorCaffe.cpp.o
[ 2%] Building CXX object src/openpose/CMakeFiles/openpose.dir/net/bodyPartConnectorCaffe.cpp.o
[ 2%] Building CXX object src/openpose/CMakeFiles/openpose.dir/net/maximumCaffe.cpp.o
[ 2%] Building CXX object src/openpose/CMakeFiles/openpose.dir/net/netCaffe.cpp.o
[ 2%] Building CXX object src/openpose/CMakeFiles/openpose.dir/net/netOpenCv.cpp.o
[ 2%] Building CXX object src/openpose/CMakeFiles/openpose.dir/net/nmsCaffe.cpp.o
[/Users/..]/openpose/src/openpose/core/arrayCpuGpu.cpp:3:14: fatal error: 'caffe/blob.hpp' file not found
#include <caffe/blob.hpp>
^~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [src/openpose/CMakeFiles/openpose.dir/core/arrayCpuGpu.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[/Users/etc..]/openpose/src/openpose/net/maximumCaffe.cpp:3:14: fatal error: 'caffe/blob.hpp' file not found
#include <caffe/blob.hpp>
^~~~~~~~~~~~~~~~
1 error generated.
[/Users..]/openpose/src/openpose/net/nmsCaffe.cpp:3:14: fatal error: 'caffe/blob.hpp' file not found
#include <caffe/blob.hpp>
^~~~~~~~~~~~~~~~
[/Users..]/openpose/src/openpose/net/netCaffe.cpp:6:14: fatal error: 'caffe/net.hpp' file not found
#include <caffe/net.hpp>
^~~~~~~~~~~~~~~
[/Users..]/openpose/src/openpose/net/netOpenCv.cpp:7:14: fatal error: 'caffe/net.hpp' file not found
#include <caffe/net.hpp>
^~~~~~~~~~~~~~~
[/Users..]/openpose/src/openpose/net/bodyPartConnectorCaffe.cpp:3:14: fatal error: 'caffe/blob.hpp' file 1not error generatedfound.
#include <caffe/blob.hpp>
^~~~~~~~~~~~~~~~
make[2]: *** [src/openpose/CMakeFiles/openpose.dir/net/maximumCaffe.cpp.o] Error 1
make[2]: *** [src/openpose/CMakeFiles/openpose.dir/net/nmsCaffe.cpp.o] Error 1
[/Users..]/openpose/src/openpose/face/faceExtractorCaffe.cpp:3:14: fatal error: 'caffe/blob.hpp' file not found
#include <caffe/blob.hpp>
^~~~~~~~~~~~~~~~
[/Users..]/openpose/src/openpose/hand/handExtractorCaffe.cpp:3:14: fatal error: 'caffe/blob.hpp' file not found
#include <caffe/blob.hpp>
^~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [src/openpose/CMakeFiles/openpose.dir/net/netCaffe.cpp.o] Error 1
1 error generated.
make[2]: *** [src/openpose/CMakeFiles/openpose.dir/net/bodyPartConnectorCaffe.cpp.o] Error 1
1 error generated.
make[2]: *** [src/openpose/CMakeFiles/openpose.dir/net/netOpenCv.cpp.o] Error 1
1 error generated.
1 error generated.
make[2]: *** [src/openpose/CMakeFiles/openpose.dir/face/faceExtractorCaffe.cpp.o] Error 1
make[2]: *** [src/openpose/CMakeFiles/openpose.dir/hand/handExtractorCaffe.cpp.o] Error 1
make[1]: *** [src/openpose/CMakeFiles/openpose.dir/all] Error 2
make: *** [all] Error 2
Why is clang failing to find blob.hpp and the other headers? I expected it to navigate to openpose/3rdparty/caffe/include, and then take it from there to find caffe/blob.hpp along with the other headers. I'm pretty new to make/c++ so I haven't tried many things other than adding the CXXFLAGS directly to the Makefile instead of passing it in through the terminal (didn't work). Here is the Makefile: https://pastebin.com/yY7R9jVe
You are using cmake. The makefiles generated by cmake don't conform to "standard" makefile conventions; in particular they don't use the CXXFLAGS
variable.
When you're using cmake, you're not expected to modify the compiler options by changing the invocation of make. Instead, you're expected to modify the compiler options by either editing the CMakeLists.txt file, or else by providing an overridden value to the cmake
command line that is used to generate your makefiles.