KleinYuan / Caffe2-iOS

Caffe2 on iOS Real-time Demo. Test with Your Own Model and Photos.
MIT License
227 stars 45 forks source link

Compilation error for release #16

Closed siargey-pisarchyk closed 7 years ago

siargey-pisarchyk commented 7 years ago

Debug build is ok. But trying to build Release produses link errors:

Undefined symbols for architecture arm64: "cv::_InputArray::_InputArray(cv::Mat const&)", referenced from: caffe2::ImageInputOp::DecodeAndTransposeOnly(std::1::basic_string<char, std::__1::char_traits, std::1::allocator >, unsigned char, int, int, std::__1::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, std::__1::bernoulli_distribution*) in libCaffe2_CPU.a(image_input_op.cc.o)

  ... other

"cv::_OutputArray::_OutputArray(cv::Mat&)", referenced from: ... other

KleinYuan commented 7 years ago

@sergey-pisarchik You can fix this issue by rebuild the opencv, since this error results from opencv is not built correctly as static/compatible (or with a bug).

I have resolved this issue in my local branch and am planning to update a new opencv.framework to all branches (I'm travelling and thus have no access to that Mac with local branch. I will fix this immediately when I get back).

If you are in a hurry, try this:

  1. Rebuild static opencv with these steps

  2. However, when do you git clone https://github.com/opencv/opencv.git, you are by default checkout the master branch, which is not guaranteed to be stable (which is why you see this error on the surface). Therefore, try to checkout to a stable released tag branch such as https://github.com/opencv/opencv/tree/2.4.3, then follow the steps above

  3. after build, delete the this framework and drag your new build inside instead.

  4. Potentially, if you still cannot archive correctly, please post your error in here. I remember I changed the Cmake file to fix one issue while fixing this bug, but cannot recall clearly that one until I get back to check my Mac. It seems like that you need to remove this line while build the opencv. Try it and let me know whether it works (referring this).

KleinYuan commented 7 years ago

@sergey-pisarchik

This commit should fix this. Also, according to our slack chat, you resolved this issue with a correct build opencv. Therefore, I think I can close this issue.

Feel free to reopen it if you still have this problem.