opencv 3.4 linux x86 + arm 双平台编译过程,开发库无需积分即可下载。

  • Post author:
  • Post category:linux


1:安装一个新的ubuntu20.04虚拟机

创建用户dev/dev

2:安装编译工具 cmake 和 arm gnueabihf编译工具

sudo apt-get update
sudo apt-get install cmake gcc g++
sudo apt-get install cmake wget
sudo apt-get install gcc-arm-linux-gnueabihf
sudo apt-get install g++-arm-linux-gnueabihf
cd .  //到达home目录/home/dev
wget https://codeload.github.com/opencv/opencv/zip/refs/heads/3.4  -O opencv-3.4.zip  //下载opencv
unzip opencv-3.4.zip
cd opencv-3.4

3:编译armgnueabihf

//创建build,build/build_arm_gnueabihf, build/build_arm_gnueabihf_install 三个目录

mkdir build build/build_arm_gnueabihf build/build_arm_gnueabihf_install

//在opencv-3.4/platforms/linux/下创建my_arm_gnueabihf.cmake 并输入如下内容:

vi platforms/linux/my_arm_gnueabihf.cmake
输入内容:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR ppc)
set(GNU_MACHINE "gcc-arm-linux-gnu" CACHE STRING "GNU compiler triple")
set(tools /usr)
set(CMAKE_C_COMPILER ${tools}/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/arm-linux-gnueabihf-g++)

保存退出。

cd build/build_arm_gnueabihf
cmake -DCMAKE_TOOLCHAIN_FILE=../../platforms/linux/my_arm_gnueabihf.cmake -DCMAKE_INSTALL_PREFIX=/home/dev/opencv-3.4/build/build_arm_gnueabihf_install ../../.
make -j12 
make install

编译结果会安装到/home/dev/opencv-3.4/build/build_arm_gnueabihf_install

4:编译linux x64

mkdir build
mkdir build/build_x64 build/build_x64_install
cd build/build_x64
cmake  -DCMAKE_INSTALL_PREFIX=/home/dev/opencv-3.4/build/build_x64_install ../../.
make -j12 
make install

编译结果会安装到/home/dev/opencv-3.4/build/build_x64_install

编译的结果可以直接免积分下载:



https://download.csdn.net/download/RJGC_Bullet/87866133?spm=1001.2014.3001.5503




版权声明:本文为RJGC_Bullet原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。