facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.94k forks source link

OSX Build Error #474

Closed rygo6 closed 7 years ago

rygo6 commented 7 years ago

I have been trying to install Caffe2 on OSX on my macbook pro. Everything seemed to be going fine until sudo make install.

I've installed protobuf every which way mentioned in the troubleshooting page: brew install protobuf && sudo pip install protobuf OR brew install protobuf && conda install -y --channel https://conda.anaconda.org/conda-forge protobuf=3.2.0

Anyone have any other ideas on how to fix this?

Ryans-MBP-2:build ryan$ sudo make install
[  0%] Built target python_copy_files
[  1%] Built target gmock
[  2%] Built target gmock_main
[  3%] Built target gtest
[  4%] Built target gtest_main
[  9%] Built target benchmark
[  9%] Built target cxx03_test
[  9%] Built target output_test_helper
[ 10%] Built target reporter_output_test
[ 11%] Built target map_test
[ 11%] Built target register_benchmark_test
[ 12%] Built target multiple_ranges_test
[ 13%] Built target fixture_test
[ 13%] Built target donotoptimize_test
[ 14%] Built target complexity_test
[ 15%] Built target skip_with_error_test
[ 16%] Built target filter_test
[ 17%] Built target basic_test
[ 18%] Built target options_test
[ 18%] Built target benchmark_test
[ 19%] Built target diagnostics_test
[ 19%] Building CXX object caffe/proto/CMakeFiles/Caffe_PROTO.dir/caffe.pb.cc.o
In file included from /Users/ryan/Developer/caffe2/build/caffe/proto/caffe.pb.cc:5:
/Users/ryan/Developer/caffe2/build/caffe/proto/caffe.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
/Users/ryan/Developer/caffe2/build/caffe/proto/caffe.pb.h:18:2: error: incompatible with your Protocol Buffer headers. Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
/Users/ryan/Developer/caffe2/build/caffe/proto/caffe.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
3 errors generated.
make[2]: *** [caffe/proto/CMakeFiles/Caffe_PROTO.dir/caffe.pb.cc.o] Error 1
make[1]: *** [caffe/proto/CMakeFiles/Caffe_PROTO.dir/all] Error 2
make: *** [all] Error 2
zhisong commented 7 years ago

I faced the same problem. I completely removed all protobuf installation and tried with brew install protobuf@3.1 It passed.

KleinYuan commented 7 years ago

@rygo6 I think they move protobuf back to 3.1.0 from 3.2.0 because of this.

I am also quite looking forwards to protobuf 3.2.0, which could increase the limit from 64MB to 2GB.

bwasti commented 7 years ago

@rygo6 Does @zhisong's advice work? I'm assuming so and closing. If not, please reopen. @KleinYuan we manually increase the limit :)

KleinYuan commented 7 years ago

@bwasti ahh, thanks and I will check this out.

Actually I also managed to manually increase the limit by changing this to the amount I want, like very huge lol (since I sense this is where Xcode complains) and rebuild iOS caffe2. :) Works perfectly. lol

sg-s commented 7 years ago

@zhisong did you then have to change something else to make sure that this version of protobuf was used by the compiler? When I removed all versions and installed 3.1, I get this error:

In file included from /code/caffe2/build/caffe/proto/caffe.pb.cc:5:
/code/caffe2/build/caffe/proto/caffe.pb.h:9:10: fatal error: 
      'google/protobuf/stubs/common.h' file not found

which seems to suggest that protobuf isn't being found. this is consistent with the warnings brew gave me when i installed protobuf@3.1:

Editor support and examples have been installed to:
  /usr/local/opt/protobuf@3.1/share/doc/protobuf@3.1

This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/protobuf@3.1/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/protobuf@3.1/lib
    CPPFLAGS: -I/usr/local/opt/protobuf@3.1/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/protobuf@3.1/lib/pkgconfig

If you need Python to find bindings for this keg-only formula, run:
  echo /usr/local/opt/protobuf@3.1/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/protobuf@3.1.pth