openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
6.79k stars 2.16k forks source link

Unable to build opencv (3.4/4.3/4.4) with openvino 2020.4 on ARM64 target #1221

Closed s-t-e-p-a-n-o-v closed 4 years ago

s-t-e-p-a-n-o-v commented 4 years ago

Hi!

During opencv build with IE enabled I got an error "undefined reference to symbol 'dlsym@@GLIBC_2.17'" in ie_core.cpp.o:

[ 91%] Linking CXX executable ../../bin/opencv_perf_dnn /usr/bin/ld: /home/ubuntu/openvino/bin/aarch64/Release/lib//libinference_engine_s.a(ie_core.cpp.o): undefined reference to symbol 'dlsym@@GLIBC_2.17' /usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status modules/dnn/CMakeFiles/opencv_perf_dnn.dir/build.make:175: recipe for target 'bin/opencv_perf_dnn' failed make[2]: [bin/opencv_perf_dnn] Error 1 CMakeFiles/Makefile2:2765: recipe for target 'modules/dnn/CMakeFiles/opencv_perf_dnn.dir/all' failed make[1]: [modules/dnn/CMakeFiles/opencv_perf_dnn.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....

opencv config:

-- Inference Engine: YES (2020040000 / Unknown) -- libs: /home/ubuntu/openvino/bin/aarch64/Release/lib/libinference_engine.so -- includes: /home/ubuntu/openvino/inference-engine/include -- nGraph: YES (0.0.0+21e0921) -- libs: /usr/local/lib/libngraph.so -- includes: /usr/local/include

opencv build options:

cmake -DCMAKE_BUILD_TYPE=Release -DWITH_GTK=ON -DWITH_INF_ENGINE=ON -DENABLE_CXX11=ON \ -DPYTHON3_EXECUTABLE=/usr/bin/python3 \ -DPYTHON3_INCLUDE_DIR=/usr/include/python3.6m \ -DPYTHON3_INCLUDE_DIR2=/usr/include/python3.6m \ -DPYTHON3_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.6m.so \ -DPYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.6/dist-packages/numpy/core/include \ -DPYTHON3_PACKAGES_PATH=/usr/lib/python3/dist-packages \ -DBUILD_OPENCV_PYTHON3=ON \ -DINF_ENGINE_LIB_DIRS=/home/ubuntu/openvino/bin/aarch64/Release/lib/ \ -DINF_ENGINE_INCLUDE_DIRS=/home/ubuntu/openvino/inference-engine/include/ \ -DCMAKE_FIND_ROOT_PATH=/home/ubuntu/openvino \ -DINF_ENGINE_RELEASE=2020040000 \ -DCMAKE_INSTALL_PREFIX=/usr/local ..

opencv linker options has dl: set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt)

openvino is a releases/2020/4 brach

ngraph was builded manualy in openvinotoolkit folder with default options cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. make -j4 sudo make install manual compile was required because export ngraph_DIR=/home/ubuntu/openvino/ngraph/cmake/ did not help opencv to find ngraph

Same results for opencv 3.4.10/4.3-openvino-2020.3/4.4-pre Is there any ideas how to fix it ?

Thanks!

dkurt commented 4 years ago

Please add all the details about procedure - what is target OS/Hardware? Do you use cross-compilation or native one?

s-t-e-p-a-n-o-v commented 4 years ago

HW is Jetson NANO (ARM64), SW is L4T Ubuntu 18.04.4 LTS

  1. builded cmake 3.14.4 according https://software.intel.com/content/www/us/en/develop/articles/arm64-sbc-and-ncs2.html
  2. builded opencv without IE
  3. builded openvino
  4. builded ngraph in openvino folder (otherwise at step 6 opencv fails to find ngraph)
  5. installed drivers and rules for USB NCS2 stick benchmark application works on MYRIAD NCS2 stick.
  6. tried to build opencv with IE support - got an error listed above.
alalek commented 4 years ago

libinference_engine_s.a

Try to remove libinference_engine*.a files from bin folder (leave only .so* files there) before step 6. These files are used for internal tests only. Alternative is to specify CMAKE_FIND_LIBRARY_SUFFIXES=.so on step 6 (this may break build or lost some components).


More details are required about OpenCV build (step 6):

s-t-e-p-a-n-o-v commented 4 years ago

I removed libinference_engine*.a (libinference_engine_preproc_s.a and libinference_engine_s.a) files from openvino folder (/home/ubuntu/openvino/bin/aarch64/Release/lib) and opencv was successfuly builded. Now inference of IR10 models works as expected on opencv 4.4-pre + openvino 2020.4
https://github.com/openvinotoolkit/openvino/issues/457

s-t-e-p-a-n-o-v commented 4 years ago

Many thanks!