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

[build_ios.sh] Two build errors #523

Closed AKoulabukhov closed 7 years ago

AKoulabukhov commented 7 years ago

Can't compile caffe2 with iOS script. Errors are occurred:

In file included from /Users/toyo/Desktop/caffe2/caffe2/operators/tile_op.cc:1:
/Users/toyo/Desktop/caffe2/caffe2/operators/tile_op.h:25:28: error: implicit
      instantiation of undefined template 'std::__1::array<int, 2>'
    std::array<int32_t, 2> temp_params = {{tiles_, axis_}};
                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__tuple:114:65: note: 
      template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY array;
                                                                ^
In file included from /Users/toyo/Desktop/caffe2/caffe2/operators/tile_op.cc:1:
/Users/toyo/Desktop/caffe2/caffe2/operators/tile_op.h:119:28: error: implicit
      instantiation of undefined template 'std::__1::array<int, 2>'
    std::array<int32_t, 2> temp_params = {{tiles_, axis_}};
                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__tuple:114:65: note: 
      template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY array;
                                                                ^
2 errors generated.
make[2]: *** [caffe2/CMakeFiles/Caffe2_CPU.dir/operators/tile_op.cc.o] Error 1
make[1]: *** [caffe2/CMakeFiles/Caffe2_CPU.dir/all] Error 2
make: *** [all] Error 2
AKoulabukhov commented 7 years ago

Attached build step:

[ 92%] Building CXX object caffe2/CMakeFiles/Caffe2_CPU.dir/operators/tile_op.cc.o
cd /Users/toyo/Desktop/caffe2/build_ios/caffe2 && /usr/bin/g++  -DCAFFE2_NO_BUILTIN_CPU_SUPPORTS -DCAFFE2_UNIQUE_LONG_TYPEMETA -DCAFFE2_USE_EIGEN_FOR_BLAS -DEIGEN_MPL2_ONLY -I/Users/toyo/Desktop/caffe2/build_ios -isystem /Users/toyo/Desktop/caffe2/third_party/protobuf/src -isystem /Users/toyo/Desktop/caffe2/third_party/NNPACK/include -isystem /Users/toyo/Desktop/caffe2/third_party/NNPACK_deps/pthreadpool/include -isystem /Users/toyo/Desktop/caffe2/third_party/eigen -isystem /Users/toyo/Desktop/caffe2/third_party/pybind11/include -I/Users/toyo/Desktop/caffe2  -fembed-bitcode -Wno-deprecated-declarations -Wno-deprecated -std=c++11 -fPIC -Wno-narrowing -O3 -DNDEBUG -arch armv7 -arch armv7s -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk   -o CMakeFiles/Caffe2_CPU.dir/operators/tile_op.cc.o -c /Users/toyo/Desktop/caffe2/caffe2/operators/tile_op.cc
huangynn commented 7 years ago

I've occurred with the same problem in OSX.

magicboker commented 7 years ago

The error said std::array is undefined so it can be resolved by including the header file, #include <array>, in caffe2/core/operator.h

bwasti commented 7 years ago

now landing the fix in #519, will close when done and build tests pass