Tips for building ICE-BA on Banana Pi M3

OpenCV installation

0. Build M3 Bsp code for installing cross-compile tool 

$ git clone https://github.com/BPI-SINOVOIP/BPI-M3-bsp.git
$ cd BPI-M3-bsp
$ mkdir -p linux-sunxi/output/lib/firmware
$ sudo ./build.sh

Then choose building kernel only: mode 3 

1. Use cmake-gui to configure and generate makefile.

(1) CMAKE_BUILD_TYPE: Release
(2) CMAKE_EXE_LINKER_FLAGS: -lpthread(or pthread) -lrt -ldl (Manually modify this part in CMakeCache.txt file)
* Also remember to modify file : common.cc [1]
(3) CMAKE_INSTALL_PREFIX: /usr/local
(4) OPENCV_GENERATE_PKGCONFIG: True
(5) OPENCV_EXTRA_MODULE_PATH: ~/opencv4.3.0/opencv_contrib-4.3.0/modules
(6) BUILD_ZLIB: True
(7) ZLIB_INCLUDE_DIR: ~/opencv4.3.0/3rdparty/zlib
(8) CMAKE_C_FLAGS: -O3 -fPIC
(9) CMAKE_CXX_FLAGS: -O3 -fPIC

* Command line: sudo cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DOPENCV_GENERATE_PKGCONFIG=On -DOPENCV_EXTRA_MODULE_PATH=../opencv_contrib-3.4.3/modules/ -DBUILD_ZLIB=True -DZLIB_INCLUDE_DIR=../3rdparty/zlib/

2. Method for solving error: undefined symbol: XRRGetMonitors

$ ldd /usr/lib/arm-linux-gnueabihf/libgdk-x11-2.0.so.0 | grep libXrandr.so.2
$ cd /usr/local/XSGX/lib 
$ sudo mv libXrandr.so.2.2.0 libXrandr.so.2.2.0.bak

Yaml, brisk installation

1. [Optional] Update gcc version => refer to [4]
2. Solution for the problem: undefined reference to `__stack_chk_fail' => refer to [5][6]
3. Solution for the problem: undefined reference to symbol 'socket@@GLIBC_2.4' => refer to [7][8]

*If you still can not fix the above errors, using cmake-gui to correctly set lib and linker as following figure. (CMAKE finds lib in /usr/local/lib by default, and then passes the argument -L/usr/local/lib to the linker, while the correct lib location is /lib/arm-linux-gnueabihf.)


3. Build ICE-BA with arm flag:

$ cd ~ICE-BA/build/
$ cmake -XU4 ..
$ make -j8

* Steps for installing newer glibc [9-11]
* For installing Armbian Ubuntu Desktop, refer to [12-13]

Reference:
[1] https://www.codenong.com/cs105923235/
[2] arm交叉编译opencv-2.4.9的步骤以及出现的问题
[3] https://kezunlin.me/post/24d22b46/
[4] https://www.youtube.com/watch?v=vVzshfYSgRk
[5] https://bbs.csdn.net/topics/350133222
[6] https://github.com/randombit/botan/issues/863
[7] http://forum.banana-pi.org/t/compiling-project-linking-fails-on-ubuntu-16-04-limesuite/4816
[8] https://askubuntu.com/questions/527665/undefined-reference-to-symbol-expglibc-2-2-5
[9] https://blog.csdn.net/ss343fd/article/details/79826777
[10] https://blog.csdn.net/Timsley/article/details/51124587
[11] https://www.itread01.com/content/1541410747.html
[12] https://longervision.github.io/2019/04/16/SBCs/ARM/banana-pi-m3-armbian/
[13] https://www.armbian.com/bananapi-m3/#kernels-archive-all

留言

這個網誌中的熱門文章

Tuing PID parameters in QGroundcontrol (2)

Useful PX4 Parameters

Burn linux image to eMMC storage on Banana Pi M3