$ sudo apt install crossbuild-essential-armhf
$ sudo apt install crossbuild-essential-arm64
Cross-compiling dependencies:
$ git clone --recursive https://github.com/xianyi/OpenBLAS.git
$ cd OpenBLAS
$ make NOFORTRAN=1 NO_SHARED=1 CC=arm-linux-gnueabihf-gcc HOSTCC=gcc TARGET=ARMV7
$ make NOFORTRAN=1 NO_SHARED=1 CC=arm-linux-gnueabihf-gcc HOSTCC=gcc TARGET=ARMV7 PREFIX=~/OpenBLAS/arm-linux-gnueabihf install
Cross-compiling MXNet:
- Download and extract MXNet: https://mxnet.apache.org/get_started/download
- Copy
arm-linux-gnueabihf-toolchain.cmake
to MXNet source directory (apache-mxnet-src-x.y.z-incubating
).
$ cd apache-mxnet-src-x.y.z-incubating
$ mkdir build
$ cd build
$ cmake -DCMAKE_TOOLCHAIN_FILE=../arm-linux-gnueabihf-toolchain.cmake \
-DUSE_CUDA=OFF \
-DSUPPORT_F16C=OFF \
-DUSE_OPENCV=OFF \
-DUSE_OPENMP=ON \
-DUSE_LAPACK=OFF \
-DUSE_SIGNAL_HANDLER=ON \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_MKL_IF_AVAILABLE=OFF \
-G Ninja ..
$ ninja
$ cmake --install . --prefix ~/MXNet/arm-linux-gnueabihf
$ cd ../python
$ export MXNET_LIBRARY_PATH=$(pwd)/build/libmxnet.so
$ python3 setup.py bdist_wheel
$ cp dist/*.whl ~/MXNet/arm-linux-gnueabihf
Cross-compiling dependencies:
$ git clone --recursive https://github.com/xianyi/OpenBLAS.git
$ cd OpenBLAS
$ make NOFORTRAN=1 NO_SHARED=1 CC=aarch64-linux-gnu-gcc HOSTCC=gcc TARGET=ARMV8
$ make NOFORTRAN=1 NO_SHARED=1 CC=aarch64-linux-gnu-gcc HOSTCC=gcc TARGET=ARMV8 PREFIX=~/OpenBLAS/aarch64-linux-gnu install
Cross-compiling MXNet:
- Download and extract MXNet: https://mxnet.apache.org/get_started/download
- Copy
aarch64-linux-gnu-toolchain.cmake
to MXNet source directory (apache-mxnet-src-x.y.z-incubating
).
$ cd apache-mxnet-src-x.y.z-incubating
$ mkdir build
$ cd build
$ cmake -DCMAKE_TOOLCHAIN_FILE=../aarch64-linux-gnu-toolchain.cmake \
-DUSE_CUDA=OFF \
-DSUPPORT_F16C=OFF \
-DUSE_OPENCV=OFF \
-DUSE_OPENMP=ON \
-DUSE_LAPACK=OFF \
-DUSE_SIGNAL_HANDLER=ON \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_MKL_IF_AVAILABLE=OFF \
-G Ninja ..
$ ninja
$ cmake --install . --prefix ~/MXNet/aarch64-linux-gnu
$ cd ../python
$ export MXNET_LIBRARY_PATH=$(pwd)/build/libmxnet.so
$ python3 setup.py bdist_wheel
$ cp dist/*.whl ~/MXNet/aarch64-linux-gnu
If you would like to compile MXNet with OpenCV support, enabling various image transformation related features, you also need to cross-compile OpenCV.