Last active
October 12, 2020 19:32
-
-
Save extrawurst/ae3fd3ef152a878acfdc860db025e886 to your computer and use it in GitHub Desktop.
build rust android lib with ndk-r18b (see also linker config: https://gist.github.com/extrawurst/3e0ad8bc967e70c0e04aefdec3172c45)
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
FROM ubuntu | |
RUN apt-get update | |
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata | |
RUN apt-get install -yq sudo curl wget git file g++ cmake pkg-config \ | |
libasound2-dev bison flex unzip ant openjdk-8-jdk \ | |
lib32stdc++6 lib32z1 libssl-dev python \ | |
g++-multilib gcc-multilib libc6-dev-i386 llvm-dev libclang-dev clang | |
RUN apt-get install -yq libncurses5 libncurses5-dev && \ | |
apt-get clean | |
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 | |
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y | |
ENV PATH /root/.cargo/bin:$PATH | |
RUN rustup target add \ | |
aarch64-linux-android \ | |
armv7-linux-androideabi \ | |
i686-linux-android | |
ENV ANDROID_HOME /usr/local/android-sdk-linux | |
RUN cd /usr/local && \ | |
wget -q https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz && \ | |
tar -xzf android-sdk_r24.4.1-linux.tgz && \ | |
rm android-sdk_r24.4.1-linux.tgz | |
RUN echo y | ${ANDROID_HOME}/tools/android update sdk --no-ui --all --filter platform-tools,build-tools-29.0.3 | |
ENV PATH $PATH:${ANDROID_HOME}/tools:$ANDROID_HOME/platform-tools | |
ENV ANDROID_SDK_ROOT /usr/local/android-ndk | |
ENV ANDROID_NDK_VERSION android-ndk-r18b | |
RUN cd /usr/local && \ | |
wget -q http://dl.google.com/android/repository/${ANDROID_NDK_VERSION}-linux-x86_64.zip && \ | |
unzip -q ${ANDROID_NDK_VERSION}-linux-x86_64.zip && \ | |
rm ${ANDROID_NDK_VERSION}-linux-x86_64.zip &&\ | |
mv /usr/local/${ANDROID_NDK_VERSION} ${ANDROID_SDK_ROOT} | |
# as soon as we go one api higher it wont work on Galaxy S4 (5.0.1) anymore with: | |
# **ERROR**: Can't open dynamic library: liblogic.so, error: dlopen failed: cannot locate symbol "__register_atfork" .. | |
RUN ${ANDROID_SDK_ROOT}/build/tools/make_standalone_toolchain.py --api 22 --arch arm64 --install-dir NDK/arm64 && \ | |
${ANDROID_SDK_ROOT}/build/tools/make_standalone_toolchain.py --api 22 --arch x86 --install-dir NDK/x86 && \ | |
${ANDROID_SDK_ROOT}/build/tools/make_standalone_toolchain.py --api 22 --arch arm --install-dir NDK/arm && \ | |
${ANDROID_SDK_ROOT}/build/tools/make_standalone_toolchain.py --api 22 --arch x86_64 --install-dir NDK/x86_64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment