簡體   English   中英

OSX Caffe編譯失敗,出現預期的表達式錯誤

[英]OSX Caffe Compilation Fails With Expected Expression Error

我一直在嘗試在運行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並遇到同樣的問題。 我不知道從哪里開始。 我對構建流程並不是非常了解,所以我很抱歉,如果這是模糊的,並樂意提供其他任何可能有助於解決此問題的信息。

謝謝!

如果使用make編譯,請按如下方式更改Makefile

- CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)

+ CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11

這與此處報告的問題相同: 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()

您只需要用protobuf v3.5.1替換最新版本的protobuf。

wget https://github.com/protocolbuffers/protobuf/archive/v3.5.1.zip

您需要下載到源代碼,並自行編譯。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM