编译OpenCV版本:
- OpenCV 4.7.0(with contribute)
- FFMPEG 4.2.9(with x264)
- Eigen 3.4.0
交叉编译目标:
- 芯片:SD3403
- 工具链:aarch64-mix210-linux-gcc
- 版本:gcc version 7.3.0 (HC&C V1R3C00SPC200B042_20221123)
编译环境:
- Ubuntu 18.04.6 LTS
- x86_64-linux-gnu
编译 zlib
如果没有此库,编译 GPAC ./configure 会输出:error: zlib not found on system or in local libs
Download :Index of /fossils (zlib.net)
https://www.zlib.net/fossils/zlib-1.2.8.tar.gz
1 | cd zlib-1.2.8 |
编译 GPAC
如果没有此库,编译 libx264 ./configure 会输出:mp4: no
Download :Downloads | GPAC (imt.fr)
git clone https://github.com/gpac/gpac.git
1 | cd gpac |
问题详情:
1 | make[1]: Entering directory '/home/easy/code/OpenSources/3403/gpac/src' |
编译 libx264
如果没有此库,编译 FFMPEG ./configure 会输出:ERROR: libx264 not found
Download :http://download.videolan.org/x264/snapshots/x264-snapshot-20191217-2245.tar.bz2
1 | tar xfj x264-snapshot-20191217-2245.tar.bz2 |
编译 FFMPEG
Download:https://ffmpeg.org/releases/ffmpeg-4.2.9.tar.xz
编译 ffmpeg:
1 | tar xvfJ ffmpeg-4.2.9.tar.xz |
交叉编译 Eigen
官网:Eigen
Download:https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz
vim toolchain_3403.cmake
1 | set(TOOLCHAIN_PRE aarch64-mix210-linux-) |
编译:
1 | mkdir -p build && cd build && mkdir ../../libeigen_3403 |
编译 OpenCV
Download:Releases - OpenCV
官方下载地址:
Releases · opencv/opencv (github.com)
镜像下载:
https://www.raoyunsoft.com/opencv/opencv-4.7.0/opencv-4.7.0.zip
https://www.raoyunsoft.com/opencv/opencv_contrib/opencv_contrib-4.7.0.zip
编译:
1 | mkdir -p build && cd build |
-D BUILD_opencv_world=ON:只生成一个统一的lib,包含所有模块,比较方便配置环境。
-D BUILD_opencv_gapi=OFF:ade/util/assert.hpp: No such file or directory
,tool-chain doesn’t support ADE,so disabled。
测试
1 | # read_video_test.cpp |
Makefile
1 | OPENCV_INC := -I./libopencv_3403/include/opencv4 |