Cross compilation for ARM based Linux systems
Table of Contents
Prev Tutorial: Installation in MacOS
Next Tutorial: MultiArch cross-compilation with Ubuntu/Debian
Prev Tutorial: Installation in MacOS
Next Tutorial: MultiArch cross-compilation with Ubuntu/Debian
| Original author | Alexander Smorkalov |
| Compatibility | OpenCV >= 3.0 |
This steps are tested on Ubuntu Linux 12.04, but should work for other Linux distributions. I case of other distributions package names and names of cross compilation tools may differ. There are several popular EABI versions that are used on ARM platform. This tutorial is written for gnueabi and gnueabihf, but other variants should work with minimal changes.
sudo apt-get install gcc-arm-linux-gnueabisudo apt-get install gcc-arm-linux-gnueabihfYou can use the latest stable OpenCV version available in sourceforge or you can grab the latest snapshot from our Git repository.
Launch Git client and clone OpenCV repository
In Linux it can be achieved with the following command in Terminal:
cd ~/<my_working _directory>
git clone https://github.com/opencv/opencv.gitcmake [<some optional parameters>] -DCMAKE_TOOLCHAIN_FILE=<path to the OpenCV source directory>/platforms/linux/arm-gnueabi.toolchain.cmake <path to the OpenCV source directory>cmake [<some optional parameters>] -DSOFTFP=ON -DCMAKE_TOOLCHAIN_FILE=<path to the OpenCV source directory>/platforms/linux/arm-gnueabi.toolchain.cmake <path to the OpenCV source directory>cd ~/opencv/platforms/linux
mkdir -p build_hardfp
cd build_hardfp
cmake -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../..makeDepending on target platform architecture different instruction sets can be used. By default compiler generates code for armv5l without VFPv3 and NEON extensions. Add -DENABLE_VFPV3=ON to cmake command line to enable code generation for VFPv3 and -DENABLE_NEON=ON for using NEON SIMD extensions.
TBB is supported on multi core ARM SoCs also. Add -DWITH_TBB=ON and -DBUILD_TBB=ON to enable it. Cmake scripts download TBB sources from official project site http://threadingbuildingblocks.org/ and build it.