watson-intu / self

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

Build for Raspberry hangs at [16%] Build CXX object lib/cpp-sdk/src/CMakeFiles/utils.dir/utils/Config.cpp.o #40

Closed nddao closed 6 years ago

nddao commented 6 years ago

I Tried to build self on Raspberry PI 3, but it hangs at line [16%] Build CXX object lib/cpp-sdk/src/CMakeFiles/utils.dir/utils/Config.cpp.o

Raspberry is frozen and clock stops working, but still can ping its IP. Tried to reboot, tc_clean.sh, and build again, but it always stops at this line. #39

[ 16%] Built target sqlite [ 16%] Building CXX object lib/cpp-sdk/src/CMakeFiles/utils.dir/utils/Config.cpp.o c++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See file:///usr/share/doc/gcc-6/README.Bugs for instructions. lib/cpp-sdk/src/CMakeFiles/utils.dir/build.make:86: recipe for target 'lib/cpp-sdk/src/CMakeFiles/utils.dir/services/Graph/Graph.cpp.o' failed make[2]: [lib/cpp-sdk/src/CMakeFiles/utils.dir/services/Graph/Graph.cpp.o] Error 4 make[2]: Waiting for unfinished jobs.... CMakeFiles/Makefile2:550: recipe for target 'lib/cpp-sdk/src/CMakeFiles/utils.dir/all' failed make[1]: [lib/cpp-sdk/src/CMakeFiles/utils.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: [all] Error 2 [ERROR]: BuildFailed Error occurred when building project self pi@raspberrypi:~/self $

takaomoriyama commented 6 years ago

A similar issue was raised as https://github.com/watson-intu/self/issues/33. Please try the followings and see what will happen.

  1. Use the latest code. We've eliminated a large plugin which might cause CPU overhead while build process. You can check the version by the following command.

    $ git --no-pager log -1
    commit 90797cc3d35a621c9370a92542fe239dacc5fefd (HEAD -> develop, origin/develop, origin/HEAD)
    Author: Takao Moriyama <moriyama@jp.ibm.com>
    Date:   Wed Sep 20 13:51:23 2017 +0900
    
    Incorporate recent changes in self plugins (#30)
    
    * Incorporate recent changes in self plugins including support for Pepper's tablet and fix for build break in PCL
    
    * Incorporate fix in plugins for issue #31
    
    *  Incorporate pull request #5 of self-plugins
    
    * Add change for pull request #7 from watson-intu/pcl_removed
  2. Reduce the number of cores to be used while build process. Change the line 33 of script/builds.sh from

    qibuild $ACTION -c "$TC_NAME" -j 4

    to

    qibuild $ACTION -c "$TC_NAME" -j 2

    . Please consider -j 1 if -j 2 is not enough.

  3. Put a heatsink on the CPU chip of your RaspberryPi as in the picture. CPU heatsink is at the center of the RaspberryPi main board

nddao commented 6 years ago

Thanks. After downloading the development build this morning and modifying build.sh to have qibuild $ACTION -c "$TC_NAME" -j 2, the compilation process went pass Config.cpp.o. but it fails at Crypt.cpp.o

[ 16%] Building CXX object lib/cpp-sdk/src/CMakeFiles/utils.dir/utils/Factory.cpp.o /home/pi/self/lib/cpp-sdk/src/utils/Crypt.cpp:30:23: error: aggregate âEVP_CIPHER_CTX g_EncodeContextâ has incomplete type and cannot be defined static EVP_CIPHER_CTX g_EncodeContext; ^~~~~~~ /home/pi/self/lib/cpp-sdk/src/utils/Crypt.cpp:37:23: error: aggregate âEVP_CIPHER_CTX g_DecodeContextâ has incomplete type and cannot be defined static EVP_CIPHER_CTX g_DecodeContext; ^~~~~~~ lib/cpp-sdk/src/CMakeFiles/utils.dir/build.make:158: recipe for target 'lib/cpp-sdk/src/CMakeFiles/utils.dir/utils/Crypt.cpp.o' failed

dpkg -l openssl ||/ Name Version Architecture Description +++-==============-============-============-================================= ii openssl 1.1.0f-3 armhf Secure Sockets Layer

nddao commented 6 years ago

After getting the changed Crypt.ccp (from https://github.com/watson-intu/cpp-sdk/pull/3/files/6fd2af755431f7767561462dc5b95c42dab041cd )

And follow the steps in https://github.com/watson-intu/self/issues/37 , I am able to compile it successfully. Note that compiling on Raspberry uses up 100% CPU resources at some points.

takaomoriyama commented 6 years ago

@nddao I'm glad to hear that you've successfully built Intu for RasPi, and I'm curious about how you handled link error which I mentioned in https://github.com/watson-intu/self/issues/37#issuecomment-338113521. Did you use new ABI by disabling use of "add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)" in self/CMakeLists.txt as described in the link above ?

Also I'd like to know which version of opencv-objdetect is installed on your environment. You can check it by the following command.

$ dpkg -l "libopencv-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:ar 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:a 2.4.9.1+dfsg1-2    armhf              computer vision Object Detection library
nddao commented 6 years ago

First, the main reason that it seems to be hang when compiling Intu on Rasbery PI is the "qibuild $ACTION -c "$TC_NAME" -j 4". With this statement, the build process could produce up to 4 processes at a time, and each process, at some point, consumes 100% CPU and 25% memory. After running for about 18 hours, the build terminsted with error "c++: internal compiler error: Killed (program cc1plus)". So using ""qibuild $ACTION -c "$TC_NAME" -j 2" works ( at least for me).

Seconds, the steps in #37, are needed for now until those changes are applied to the official build. Here are steps that I changed in my Raspberry to have a successfully compilation of Intu. a) Getting the new Crypt.ccp (from https://github.com/watson-intu/cpp-sdk/pull/3/files/6fd2af755431f7767561462dc5b95c42dab041cd ) b) Add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char") add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) to the ~/self/CMakeLists.txt( Note that I just want to built Intu on Raspberry) Then run scripts/build_raspi.sh

pi@raspberrypi:~/self $ dpkg -l "libopencv-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-objd 2.4.9.1+dfsg armhf development files for libopencv-o un libopencv-objd (no description available) ii libopencv-objd 2.4.9.1+dfsg armhf computer vision Object Detection

takaomoriyama commented 6 years ago

@nddao Thanks for posting. It is quite interesting for me because you are using old-ABI (-D_GLIBCXX_USE_CXX11_ABI=0) and opencv-objdump is v2.4.9.1, which is same as mine, and no linking error. In my case, the following like error occurs.

[ 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
takaomoriyama commented 6 years ago

I think all issues were resolved. I also changed the number of compiler processes to two in script/build.sh for Raspi. The latest code is included in PR https://github.com/watson-intu/self/pull/39. Thanks for your help!