Log in

View Full Version : Compiling OpenCV from source for ARM (RoboRio) in Ubuntu/Debian/Mint


FleventyFive
19-01-2015, 21:40
Install dependencies

sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install g++-arm-linux-gnueabi

Enter directory that will hold opencv

cd ~/Documents

Clone OpenCV from git
git clone https://github.com/Itseez/opencv.git
Checkout to a recent OpenCV release (change 2.4.10.1 to a recent release)

cd opencv
git checkout tags/2.4.10.1

Set toolchain to correct version of g++ (change line in file or run this complicated one-liner

cd platforms/linux

x=$(dpkg -s g++-arm-linux-gnueabi | grep "Version" | grep -o ".\.."); sed -i 's/set(GCC_COMPILER_VERSION "*.*"/set(GCC_COMPILER_VERSION \"'$x'\" CACHE STRING "GCC Compiler version"/g' arm-gnueabi.toolchain.cmake


Prepare file for build

mkdir build_roborio
cd build_roborio
cmake -DSOFTFP=ON -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../..

Build project (this will take a while)

make