| # -*- mode: dockerfile -*- |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| # |
| # Dockerfile to build MXNet for Android ARMv7 |
| |
| FROM ubuntu:20.04 |
| |
| ENV ARCH=armv7l \ |
| HOSTCC=gcc \ |
| HOSTCXX=g++ \ |
| TARGET=ARMV7 |
| |
| WORKDIR /usr/local |
| |
| RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ |
| build-essential \ |
| ninja-build \ |
| cmake \ |
| ccache \ |
| git \ |
| curl \ |
| unzip \ |
| && rm -rf /var/lib/apt/lists/* |
| |
| RUN curl -o android-ndk-r19-linux-x86_64.zip -L https://dl.google.com/android/repository/android-ndk-r19-linux-x86_64.zip && \ |
| unzip android-ndk-r19-linux-x86_64.zip && \ |
| rm android-ndk-r19-linux-x86_64.zip |
| ENV CMAKE_TOOLCHAIN_FILE=/usr/local/android-ndk-r19/build/cmake/android.toolchain.cmake |
| |
| RUN git clone --recursive -b v0.3.9 https://github.com/xianyi/OpenBLAS.git && \ |
| mkdir /usr/local/openblas-android && \ |
| cd /usr/local/OpenBLAS && \ |
| export TOOLCHAIN=/usr/local/android-ndk-r19/toolchains/llvm/prebuilt/linux-x86_64 && \ |
| make NOFORTRAN=1 ARM_SOFTFP_ABI=1 NO_SHARED=1 \ |
| LDFLAGS="-L/usr/local/android-ndk-r19/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x -lm" \ |
| CC=$TOOLCHAIN/bin/armv7a-linux-androideabi16-clang AR=$TOOLCHAIN/bin/arm-linux-androideabi-ar && \ |
| make PREFIX=/usr/local/openblas-android NO_SHARED=1 install && \ |
| cd /usr/local && \ |
| rm -rf OpenBLAS |
| ENV OpenBLAS_HOME=/usr/local/openblas-android |
| |
| ARG USER_ID=0 |
| ARG GROUP_ID=0 |
| COPY install/ubuntu_adduser.sh /work/ |
| RUN /work/ubuntu_adduser.sh |
| |
| COPY runtime_functions.sh /work/ |
| WORKDIR /work/build |