Skip to content

Build From Source

Haidong Lan edited this page May 7, 2018 · 1 revision

Build From Source

We demonstrate the building steps for ARM-Linux/Android/iOS on Ubuntu and macOS, respectively. We have placed a dozen of building scripts in the FeatherCNN/build_scripts directory. Before building, download the source code and then enter the directory.

git clone https://github.com/tencent/FeatherCNN && cd FeatherCNN

The scripts MUST be called at the root folder, FeatherCNN. Do not enter subdirectories to call the scripts

Build for ARM-Linux

Building for ARM-Linux is most convenient on Ubuntu. Basically it only requires cmake and aarch64-linux-g++ to build our library. You can install by typing

sudo apt-get install cmake g++-aarch64-linux-gnu

If you compile on the target device, for example the Tegra TX2 or an ARM-based server, the aarch64-linux-g++ should come by default. We proceed with the building script

./build_scripts/build_linux.sh

The built library should appear in build-linux-aarch64/install/feather

Build for Android

Note: A known issue is that cmake 3.9.1 (comes with Ubuntu 17.10.1) have troubles in finding OpenMP support in Android NDK. Please try another cmake version if you meet any problems.

We use the Android NDK to build the libraries. Firstly you need to download NDK from the official site, and then uncompress that zip archive to wherever you want. An environment variable should be set to tell the script where to find the NDK package.

export NDK_ROOT=YOUR_PATH_TO_NDK

for example

export NDK_ROOT=/opt/android-ndk-r16b

Again, run the script at the root directory

./build_scripts/build_android.sh

The built library should appear in build-android/install/feather.

Build for iOS

Building for iOS is only supported on macOS. It's possible to set up a cross-compile environment on Linux, but too complex. For a clean Mac, you need to install the Xcode, and then the Xcode Commandline Tools by

xcode-select --install

This should enable xcrun and cmake. Then run the script at the root directory

./build_scripts/build_ios.sh

The script compiles for arm64, armv7s and simulator. For simulators, Feather runs through an empty interface which simply does nothing. This script also packs the library into iOS framework. You can use it in Xcode easily as other frameworks.