watson-intu / self

Intu is a Cognitive Embodiment Middleware for AI on the edge.
Other
29 stars 27 forks source link

Build for Raspbery Pi fails #38

Closed takaomoriyama closed 6 years ago

takaomoriyama commented 6 years ago

Linker could not find cv::CascadeClassifier::load() on Raspi. Raspbian

$ ./scripts/build_raspi.sh
...
Scanning dependencies of target self_instance
[ 70%] Linking CXX executable sdk/bin/self_instance
sdk/lib/libself.so:  undefined reference to `cv::CascadeClassifier::load(std::string const&)'
collect2: error: ld returned 1 exit status
CMakeFiles/self_instance.dir/build.make:137: recipe for target 'sdk/bin/self_instance' failed
make[2]: *** [sdk/bin/self_instance] Error 1
CMakeFiles/Makefile2:76: recipe for target 'CMakeFiles/self_instance.dir/all' failed
make[1]: *** [CMakeFiles/self_instance.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2
[ERROR]: BuildFailed Error occurred when building project self
$ uname -a
Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
$ dpkg -l "*opencv-objdetect*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                        Version            Architecture       Description
+++-===========================-==================-==================-============================================================
ii  libopencv-objdetect-dev:arm 2.4.9.1+dfsg1-2    armhf              development files for libopencv-objdetect
un  libopencv-objdetect2.4      <none>             <none>             (no description available)
ii  libopencv-objdetect2.4v5:ar 2.4.9.1+dfsg1-2    armhf              computer vision Object Detection library
takaomoriyama commented 6 years ago

This seems to be a problem in the OpenCV library (objdetect). A tentative solution is to disable local detection of person in src/classifiers/PersonClassifier.cpp as follows:

#define ENABLE_LOCAL_DETECTION              0
takaomoriyama commented 6 years ago

libopencv-objdetect package for Raspi seem to support only 2011 C++ standard ABI. No compatibility with older ABI. In the other hand, "-D_GLIBCXX_USE_CXX11_ABI=0" was introduced by the following commit and Intu has been compiled with old ABI.

commit adfd7924bc0c93517a581c36bf10d585c52d16b3
Author: Richard Lyle <rlyle@cognitivescale.com>
Date:   Fri Aug 11 11:09:22 2017 -0500

    Fixing build for ubuntu 16.04

Ref: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html Proposed solution is to stop using "-D_GLIBCXX_USE_CXX11_ABI=0"

takaomoriyama commented 6 years ago

Merged to https://github.com/watson-intu/self/issues/37