diff options
author | aguestuser <aguestuser@risup.net> | 2017-04-23 16:39:03 -0400 |
---|---|---|
committer | aguestuser <aguestuser@risup.net> | 2017-04-30 20:05:35 -0400 |
commit | e79058d8797c918d37e406245ca7683cf07240d1 (patch) | |
tree | 3229f9f4eef202fd1cf1f5a039af74ea8aa9f375 /docker | |
parent | a7b4f463e4ffc282814ef74daf18c74581fc3a7d (diff) |
[ag] Fix native build step with revised dockerfile
* PROBLEM:
* most recent version (r14b) of `android-ndk` uses `clang` for cross-compilation
* BUT: `openssl` cannot compile successfully w/ `clang`
* AND: we depend on `openssl` transitively through `ics-openvpn`
while trying to use `android-ndk` r14b
* FIX:
* downgrade to `android-ndk` (12b) (most recent versoin that still
uses `gcc` instead of `clang`)
* modify some of the default
* REMAINING PROBLEMS:
* some string translations for Jamaica now break the build (unclear
why -- outdated country abbreviation? ja for jm???)
* we are now using a version of ndk that is 2 versions old and a
version of ics-openvpn (pinned to a 3.1.2016 commit via submodule)
that depends on an outdated version of `openssl`, which raises
security concerns. updating to the most recent version will force
us to wade into all the dependency problems amongst `ics-openvpn`/`openssl`/`ndk`
* REFERENCES:
* on `openssl` incompatibility w/ clang: https://github.com/openssl/openssl/pull/2229
* on `ics-openvpn` problems with `ndk`: https://github.com/android-ndk/ndk/issues/144
Diffstat (limited to 'docker')
-rw-r--r-- | docker/android-sdk.dockerfile | 86 |
1 files changed, 60 insertions, 26 deletions
diff --git a/docker/android-sdk.dockerfile b/docker/android-sdk.dockerfile index dddf54c6..31b89d4c 100644 --- a/docker/android-sdk.dockerfile +++ b/docker/android-sdk.dockerfile @@ -4,6 +4,22 @@ MAINTAINER LEAP Encryption Access Project <info@leap.se> LABEL Description="Android SDK baseimage based on debian:stretch" Vendor="LEAP" Version="0.0.1" # ------------------------------------------------------ +# --- Env Vars + + +ENV ANDROID_SDK_VERSION "25.2.5" +ENV ANDROID_NDK_VERSION "r12b" + +# NOTE(@aguestuser|4.23.17) +# We woud like to use te current version of Android NDK () + +ENV ANDROID_HOME /opt/android-sdk-linux +ENV ANDROID_NDK_HOME ${ANDROID_HOME}/android-ndk-${ANDROID_NDK_VERSION} + +ENV ANDROID_SDK_URL https://dl.google.com/android/repository/tools_r${ANDROID_SDK_VERSION}-linux.zip +ENV ANDROID_NDK_URL http://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip + +# ------------------------------------------------------ # --- Install System Dependencies # Update Debian @@ -12,13 +28,11 @@ RUN apt-get update -qq # Install Debian Packages RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ # the basics - wget unzip git locales \ + curl unzip git locales \ # java stuff openjdk-8-jdk maven \ # c libraries - make clang lib32stdc++6 lib32z1 # (incl. 32-bit compatible versions) - -# libgcc-6-dev-arm64-cross + make gcc lib32stdc++6 lib32z1 # (incl. 32-bit compatible versions) # Set Locale RUN locale-gen en_US.UTF-8 @@ -27,19 +41,54 @@ RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 # ------------------------------------------------------ # --- Install Android SDK Tools -ENV ANDROID_HOME /opt/android-sdk-linux -ENV SDK_TOOLS_VERSION "25.2.5" # Install SDK Tools -RUN cd /opt \ - && wget -q -O sdk-tools.zip \ - https://dl.google.com/android/repository/tools_r${SDK_TOOLS_VERSION}-linux.zip \ - && unzip -q sdk-tools.zip -d ${ANDROID_HOME} \ +RUN curl -L $ANDROID_SDK_URL -o sdk-tools.zip \ + && unzip -q sdk-tools.zip -d $ANDROID_HOME \ && rm -f sdk-tools.zip # Update PATH ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools +# ------------------------------------------------------ +# --- Install Android NDK (for running C code) + +RUN curl -L $ANDROID_NDK_URL -o ndk.zip \ + && unzip ndk.zip -d $ANDROID_HOME \ + && rm -rf ndk.zip + +# HACK (@aguestuser|4.23.17): + +# BUG: +# when installed on a 64-bit machine, ndk r12b +# fails to cross-compile for *some* (not all) target architectures +# because it looks for prebuilt packages in <path/to/arch>/prebuilt/linux-x86 +# instead of <path/to/arch>/prebuilt/linux-x86_64 (which is where it installed them) + +# PENDING: +# (1) a cleaner solution +# (2) upgrading to ndk r14b (pending openssl/clang bugfix: https://github.com/openssl/openssl/pull/2229) + +# WORKAROUND: +# we simply rename all such directories so the cross-compiler can find them + +ENV TARGETS "aarch64-linux-android-4.9 \ + arm-linux-androideabi-4.9 \ + mipsel-linux-android-4.9 \ + x86-4.9 \ + x86_64-4.9" + +RUN for target in $TARGETS; do \ + cd ${ANDROID_NDK_HOME}/toolchains/${target}/prebuilt \ + && mv linux-x86_64/ linux-x86/; \ + done + +ENV PATH ${PATH}:${ANDROID_NDK_HOME} + +# ------------------------------------------------------ +# --- Install Android SDK Tools Packages + + # Install Platform Tools Package RUN echo y | sdkmanager "platform-tools" # echo y to accept google licenses @@ -53,26 +102,11 @@ RUN echo y | sdkmanager "platforms;android-23" # Install Build Tools (Please keep in descending order) RUN echo y | sdkmanager "build-tools;25.0.2" +RUN echo y | sdkmanager "build-tools;25.0.0" RUN echo y | sdkmanager "build-tools;24.0.3" RUN echo y | sdkmanager "build-tools;23.0.3" # ------------------------------------------------------ -# --- Install Android NDK (for running C code) - -ENV ANDROID_NDK_HOME ${ANDROID_HOME}/ndk-bundle - -# Install NDK packages from sdk tools - -RUN echo y | sdkmanager "ndk-bundle" -RUN echo y | sdkmanager "cmake;3.6.3155560" -RUN echo y | sdkmanager "lldb;2.3" - -# Update PATH - -ENV PATH ${PATH}:${ANDROID_NDK_HOME} - - -# ------------------------------------------------------ # --- Install Android Emulator |