Closed mjohnst closed 7 years ago
Ah, this happens when the libraries are not linked with whole static library flags. I assume that you are running it on Mac OS? The way to do it is to pass
-Wl,-force_load,libCaffe2_CPU.a
which ensures that Caffe2's operators are registered.
edit: fixed typo from force-load to force_load.
Thanks for the response @Yangqing, I am building it on Mac OS, I'll try passing those flags.
I think this works since it's uncovered new build issues with OpenCV (don't have the framework added yet). The flag has a typo in your post for anyone else referencing: it's -force_load
instead of -force-load
I'll post back if the error continues after I resolve OpenCV issues.
Sounds perfect. You can optionally do -DUSE_OPENCV=OFF
to turn off opencv.
@mjohnst Please let me know if you've been successful. I cannot quite solve this yet.
@mjohnst I was able to get this working taking a similar approach: Caffe2 iOS Tutorial
I haven't had success yet. I'm attempting to re-build without OpenCV, but am getting some new errors I didn't have last time around.
First modified Makefile
and added -DUSE_OPENCV=OFF -DUSE_CUDA=OFF
ran make
from root directory and sudo make install
from build
directory (building for macOS).
Second I modified scripts/build_ios.sh
and added -DUSE_OPENCV=OFF
and ran it.
Upon running sudo make install
from build_ios
I encountered:
CMake Error at third_party/protobuf/cmake/cmake_install.cmake:47 (file):
file INSTALL cannot find
"/Users/mjohnst/src/caffe2/build_ios/third_party/protobuf/cmake/libprotoc.a".
Call Stack (most recent call first):
cmake_install.cmake:32 (include)
Looking into fixing these errors, then I should hopefully make some more progress :)
@jquave I'll give that tutorial a shot, thanks for the link!
@jquave tutorial works great, no issues anymore
@mjohnst I met the same problem. [E operator.cc:72] Cannot find operator schema for GivenTensorFill. Will skip schema checking. I tried to build caffe2 on Android by eclipse. I think @Yangqing is right. This problem happens when the libraries are not linked with whole static library. In Android.mk, I need to set LOCAL_WHOLE_STATIC_LIBRARIES := $(LOCAL_MODULE for libcaffe2.a) To build on iOS, I think you need to add -Wl, -force_load flags.
I am implementing C++ API in Objective-C++. Here's a summarization of my logic
Using Squeezenet Caffe2 Zoo
pb
sThis is my error when I hit the
Predictor
constructor:Linked libs:
My lib search paths:
My header search paths:
I am able to compile & run on device with the header for
GivenTensorFill
imported too