This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
204 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,68 +18,46 @@ | |
# | ||
# Dockerfile to build MXNet for Android ARMv7 | ||
|
||
FROM dockcross/base | ||
MAINTAINER Pedro Larroy "[email protected]" | ||
|
||
# The cross-compiling emulator | ||
RUN apt-get update && apt-get install -y \ | ||
unzip | ||
|
||
ENV CROSS_TRIPLE=arm-linux-androideabi | ||
ENV CROSS_ROOT=/usr/${CROSS_TRIPLE} | ||
ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as \ | ||
AR=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ar \ | ||
CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc \ | ||
CPP=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-cpp \ | ||
CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-g++ \ | ||
LD=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ld | ||
|
||
ENV ANDROID_NDK_REVISION 17b | ||
ENV ANDROID_NDK_API 27 | ||
ENV ANDROID_NDK_ARCH arm | ||
WORKDIR /work/deps | ||
COPY install/android_ndk.sh /work/deps | ||
RUN /work/deps/android_ndk.sh | ||
|
||
ENV DEFAULT_DOCKCROSS_IMAGE dockcross/android-arm | ||
|
||
# Build-time metadata as defined at http://label-schema.org | ||
ARG BUILD_DATE | ||
ARG IMAGE | ||
ARG VCS_REF | ||
ARG VCS_URL | ||
LABEL org.label-schema.build-date=$BUILD_DATE \ | ||
org.label-schema.name=$IMAGE \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vcs-url=$VCS_URL \ | ||
org.label-schema.schema-version="1.0" | ||
FROM ubuntu:19.10 | ||
|
||
ENV ARCH armv7l | ||
ENV HOSTCC gcc | ||
ENV HOSTCXX g++ | ||
ENV TARGET ARMV7 | ||
|
||
ENV CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-clang | ||
ENV CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-clang++ | ||
WORKDIR /usr/local | ||
|
||
WORKDIR /work/deps | ||
|
||
COPY install/deb_ubuntu_ccache.sh /work/ | ||
RUN /work/deb_ubuntu_ccache.sh | ||
WORKDIR /work | ||
COPY install/ubuntu_arm.sh /work/ | ||
RUN /work/ubuntu_arm.sh | ||
|
||
COPY install/arm_openblas.sh /work/ | ||
COPY install/android_armv7_openblas.sh /work/deps | ||
RUN /work/deps/android_armv7_openblas.sh | ||
|
||
ENV OpenBLAS_HOME=${CROSS_ROOT} | ||
ENV OpenBLAS_DIR=${CROSS_ROOT} | ||
|
||
WORKDIR /work | ||
RUN apt-get update && 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 \ | ||
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 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/mxnet | ||
|
||
WORKDIR /work/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,68 +18,46 @@ | |
# | ||
# Dockerfile to build MXNet for Android ARM64/ARMv8 | ||
|
||
FROM dockcross/base | ||
MAINTAINER Pedro Larroy "[email protected]" | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
unzip | ||
|
||
WORKDIR /work/deps | ||
|
||
# Build x86 dependencies. | ||
COPY install/deb_ubuntu_ccache.sh /work/ | ||
RUN /work/deb_ubuntu_ccache.sh | ||
|
||
# Setup Android cross-compilation environment. | ||
ENV CROSS_TRIPLE=aarch64-linux-android | ||
ENV CROSS_ROOT=/usr/${CROSS_TRIPLE} | ||
ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as \ | ||
AR=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ar \ | ||
CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc \ | ||
CPP=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-cpp \ | ||
CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-g++ \ | ||
LD=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ld | ||
|
||
|
||
ENV DEFAULT_DOCKCROSS_IMAGE dockcross/android-arm | ||
|
||
# Build-time metadata as defined at http://label-schema.org | ||
ARG BUILD_DATE | ||
ARG IMAGE | ||
ARG VCS_REF | ||
ARG VCS_URL | ||
LABEL org.label-schema.build-date=$BUILD_DATE \ | ||
org.label-schema.name=$IMAGE \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vcs-url=$VCS_URL \ | ||
org.label-schema.schema-version="1.0" | ||
FROM ubuntu:19.10 | ||
|
||
ENV ARCH aarch64 | ||
ENV ANDROID_NDK_REVISION 17b | ||
ENV ANDROID_NDK_API 27 | ||
ENV ANDROID_NDK_ARCH arm64 | ||
WORKDIR /work/deps | ||
COPY install/android_ndk.sh /work/deps | ||
RUN /work/deps/android_ndk.sh | ||
|
||
ENV HOSTCC gcc | ||
ENV HOSTCXX g++ | ||
ENV TARGET ARMV8 | ||
|
||
WORKDIR /work/deps | ||
COPY install/android_ndk.sh /work/ | ||
RUN /work/android_ndk.sh | ||
WORKDIR /usr/local | ||
|
||
ENV CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-clang | ||
ENV CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-clang++ | ||
|
||
# Build ARM dependencies. | ||
COPY install/android_arm64_openblas.sh /work/ | ||
RUN /work/android_arm64_openblas.sh | ||
ENV CPLUS_INCLUDE_PATH /work/deps/OpenBLAS | ||
RUN apt-get update && 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 \ | ||
LDFLAGS="-L/usr/local/android-ndk-r21/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x -lm" \ | ||
CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang AR=$TOOLCHAIN/bin/aarch64-linux-android-ar && \ | ||
make PREFIX=/usr/local/openblas-android 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.