Caffe: Caffe build failure in MacOS

Created on 24 Jan 2019  ·  4Comments  ·  Source: BVLC/caffe

Important - read before submitting

Please read the guidelines for contributing before submitting this issue!

Please do not post installation, build, usage, or modeling questions, or other requests for help to Issues.
Use the caffe-users list instead.
This helps developers maintain a clear, uncluttered, and efficient view of the state of Caffe.

Issue summary

When I try to build "Caffe" in MacOS, the errors are reported for protobuf corresponding issues:
ls: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/: No such file or directory
PROTOC src/caffe/proto/caffe.proto
CXX .build_release/src/caffe/proto/caffe.pb.cc
In file included from .build_release/src/caffe/proto/caffe.pb.cc:4:
In file included from .build_release/src/caffe/proto/caffe.pb.h:23:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:135:
/usr/local/include/google/protobuf/stubs/common.h:190:17: error: expected expression
OnShutdownRun( { delete static_cast(pp); }, p);
^
In file included from .build_release/src/caffe/proto/caffe.pb.cc:4:
In file included from .build_release/src/caffe/proto/caffe.pb.h:26:
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:45:
/usr/local/include/google/protobuf/message_lite.h:136:3: error: unknown type name 'constexpr'
constexpr const T& get() const { return reinterpret_cast ^
/usr/local/include/google/protobuf/message_lite.h:136:13: error: expected member name or ';' after declaration specifiers
constexpr const T& get() const { return reinterpret_cast ~~~ ^
/usr/local/include/google/protobuf/message_lite.h:129:11: error: use of undeclared identifier 'union_'
new (&union_) T();
^
/usr/local/include/google/protobuf/message_lite.h:133:5: error: use of undeclared identifier 'get_mutable'
get_mutable()->~T();
^
/usr/local/include/google/protobuf/message_lite.h:150:45: error: found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?
PROTOBUF_EXPORT extern ExplicitlyConstructed<::std::string>
^
/usr/local/include/google/protobuf/message_lite.h:155:37: error: no member named 'get' in 'google::protobuf::internal::ExplicitlyConstructed >'
return fixed_address_empty_string.get();
~
~~~~~~~ ^
/usr/local/include/google/protobuf/message_lite.h:513:3: error: unknown type name 'constexpr'
constexpr bool alias = flags & kMergeWithAliasing;
^
/usr/local/include/google/protobuf/message_lite.h:513:13: error: expected unqualified-id
constexpr bool alias = flags & kMergeWithAliasing;
^
/usr/local/include/google/protobuf/message_lite.h:514:41: error: use of undeclared identifier 'alias'
return internal::MergePartialFromImpl(input, this) &&
^
In file included from .build_release/src/caffe/proto/caffe.pb.cc:4:
In file included from .build_release/src/caffe/proto/caffe.pb.h:26:
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:46:
/usr/local/include/google/protobuf/repeated_field.h:130:39: error: expected ';' at end of declaration list
RepeatedField(RepeatedField&& other) noexcept;
^
/usr/local/include/google/protobuf/repeated_field.h:131:50: error: expected ';' at end of declaration list
RepeatedField& operator=(RepeatedField&& other) noexcept;
^
/usr/local/include/google/protobuf/repeated_field.h:787:45: error: expected ';' at end of declaration list
RepeatedPtrField(RepeatedPtrField&& other) noexcept;
^
/usr/local/include/google/protobuf/repeated_field.h:788:56: error: expected ';' at end of declaration list
RepeatedPtrField& operator=(RepeatedPtrField&& other) noexcept;
^
/usr/local/include/google/protobuf/repeated_field.h:1097:68: error: expected ';' at end of declaration
inline RepeatedField::RepeatedField(RepeatedField&& other) noexcept
^
/usr/local/include/google/protobuf/repeated_field.h:1097:69: error: unknown type name 'noexcept'
inline RepeatedField::RepeatedField(RepeatedField&& other) noexcept
^
/usr/local/include/google/protobuf/repeated_field.h:1098:5: error: expected unqualified-id
: RepeatedField() {
^
/usr/local/include/google/protobuf/repeated_field.h:1110:27: error: expected ';' at end of declaration
RepeatedField&& other) noexcept {
^
/usr/local/include/google/protobuf/repeated_field.h:1110:28: error: C++ requires a type specifier for all declarations
RepeatedField&& other) noexcept {
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: * [.build_release/src/caffe/proto/caffe.pb.o] Error 1

Steps to reproduce

git clone https://github.com/BVLC/caffe
cd caffe
make all

Tried solutions

System configuration

  • Operating system:
  • Compiler:
  • CUDA version (if applicable):
  • CUDNN version (if applicable):
  • BLAS:
  • Python version (if using pycaffe):
  • MATLAB version (if using matcaffe):

Issue checklist

  • [ ] read the guidelines and removed the first paragraph
  • [ ] written a short summary and detailed steps to reproduce
  • [ ] explained how solutions to related problems failed (tick if found none)
  • [ ] filled system configuration
  • [ ] attached relevant logs/config files (tick if not applicable)

Most helpful comment

I meet the same issue, have you solved it ?

All 4 comments

Has anyone found a solution to this issue? @momo1986

I meet the same issue, have you solved it ?

I have the same issue too, it seems like the version issue of the protobuf

If build with cmake, you can change CMakeLists.txt as follows:

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()

or build with make, change Makefile as follows:
```
- CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
+ CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prathmeshrmadhu picture prathmeshrmadhu  ·  3Comments

weather319 picture weather319  ·  3Comments

sdemyanov picture sdemyanov  ·  3Comments

iamhankai picture iamhankai  ·  3Comments

dfotland picture dfotland  ·  3Comments