我一直在尝试在运行OSX 10.13.6的Mac上安装Caffe
我遵循了一些指南,包括caffe网站上的安装指南。我已经擦除了所有内容并重新启动了几次。无论如何,我都会遇到同样的问题。当我去编译所有东西时,我会得到这个
Scanning dependencies of target caffeproto
[ 1%] Building CXX object src/caffe/CMakeFiles/caffeproto.dir/__/__/include/caffe/proto/caffe.pb.cc.o
In file included from /Users/Name/Documents/Programming/PythonEnv/caffe/build/include/caffe/proto/caffe.pb.cc:4:
In file included from /Users/Name/Documents/Programming/PythonEnv/caffe/build/include/caffe/proto/caffe.pb.h:9:
/usr/local/include/google/protobuf/stubs/common.h:209:17: error: expected
expression
OnShutdownRun([](const void* p) { delete static_cast<const T*>(p); }, p);
^
In file included from /Users/Name/Documents/Programming/PythonEnv/caffe/build/include/caffe/proto/caffe.pb.cc:4:
In file included from /Users/Name/Documents/Programming/PythonEnv/caffe/build/include/caffe/proto/caffe.pb.h:25:
In file included from /usr/local/include/google/protobuf/generated_message_table_driven.h:34:
In file included from /usr/local/include/google/protobuf/map.h:49:
In file included from /usr/local/include/google/protobuf/map_type_handler.h:35:
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_); }
我也尝试过使用CMake并遇到相同的问题。我不确定从这里去哪里。对于构建过程,我的知识并不十分了解,因此,我对此是否含糊表示歉意,并很乐意提供其他任何可能有助于解决此问题的信息。
谢谢!
答案 0 :(得分:4)
如果使用make
进行编译,请按以下方式更改Makefile
:
- CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
+ CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
答案 1 :(得分:2)
这是与此处报告的问题相同的问题:https://trac.macports.org/ticket/57093#comment:1
编译器需要使用C ++ 11。尝试在CMakeLists.txt
中进行此更改:
if(UNIX OR APPLE)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -std=c++11")
endif()
答案 2 :(得分:1)
您只需要用protobuf v3.5.1替换protobuf的最新版本即可。
wget https://github.com/protocolbuffers/protobuf/archive/v3.5.1.zip
您需要下载源代码,然后自己进行编译。