rk3588交叉编译opencv

发布于:2024-11-29 ⋅ 阅读:(32) ⋅ 点赞:(0)

基于forlinx开发板Linux5.10.66+Qt5.15.2的环境

交叉编译工具链:aarch64-buildroot-linux-gnu-gcc、aarch64-buildroot-linux-gnu-g++

opencv版本:3.4.15

创建toolchain.cmake


# 工具链路径
set(CMAKE_C_COMPILER /home/forlinx/aarch64-buildroot-linux-gnu_sdk-buildroot/bin/aarch64-buildroot-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER /home/forlinx/aarch64-buildroot-linux-gnu_sdk-buildroot/bin/aarch64-buildroot-linux-gnu-g++)

# sysroot 路径
set(CMAKE_FIND_ROOT_PATH /home/forlinx/aarch64-buildroot-linux-gnu_sdk-buildroot/aarch64-buildroot-linux-gnu/sysroot)
set(PKG_CONFIG_LIBDIR /home/forlinx/aarch64-buildroot-linux-gnu_sdk-buildroot/aarch64-buildroot-linux-gnu/sysroot/usr/lib64/pkgconfig)


set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 

编译

mkdir build

cd build

export PATH=/home/forlinx/aarch64-buildroot-linux-gnu_sdk-buildroot/bin/:$PATH
export PKG_CONFIG_PATH=/home/forlinx/aarch64-buildroot-linux-gnu_sdk-buildroot/aarch64-buildroot-linux-gnu/sysroot/usr/lib64/pkgconfig/

cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \
-D WITH_GSTREAMER=ON \
-D CMAKE_BUILD_TYPE=RELEASE \
-D WITH_QT=ON \
-D WITH_IPP=OFF \
-D CMAKE_INSTALL_PREFIX=./cbInstall \
..

make -j8

make install

我这边需要用gstreamer和qt显示所以打开了 对应配置