summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authoraguestuser <aguestuser@risup.net>2017-04-23 20:36:37 -0400
committeraguestuser <aguestuser@risup.net>2017-04-30 20:05:35 -0400
commit215edb9840e5a75ed961fbf8b6ce423116deef28 (patch)
tree500f10c9caa59cf484f26057811e83f4514555d4 /docker
parente79058d8797c918d37e406245ca7683cf07240d1 (diff)
[ag] eliminate hacky workaround for 64-bit builds
* HACK: replace all toolchain references to `linux-x86_64` with `linux-x86` * FIX: provide dependency on `file` package that will allow `ndk-build` to detect 32-bit userland, making this * side-effects: * group sdk/env vars with installation code that uses them * add explanatory note about why we use outdated version of `android-ndk` ------------------ *Explanation:* More careful analysis of the meaning of the word `file` in this (subtle!) error message: ```shell /opt/android-sdk-linux/android-ndk-r12b/build/ndk-build: 143: /opt/android-sdk-linux/android-ndk-r12b/build/ndk-build: file: not found ``` led to inspecting line 143 of `ndk-build`, revealing an undefined variable called `file` that would allow `ndk-build` to detect a 32-bit userland: ```shell file -L "$SHELL" | grep -q "x86[_-]64" ``` Thus the error messsage was *not* trying to tell us that a file could not be found, but that the program called `file` could not be found. FUN! :)
Diffstat (limited to 'docker')
-rw-r--r--docker/android-sdk.dockerfile61
1 files changed, 17 insertions, 44 deletions
diff --git a/docker/android-sdk.dockerfile b/docker/android-sdk.dockerfile
index 31b89d4c..468546cf 100644
--- a/docker/android-sdk.dockerfile
+++ b/docker/android-sdk.dockerfile
@@ -4,22 +4,6 @@ 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
@@ -31,8 +15,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl unzip git locales \
# java stuff
openjdk-8-jdk maven \
- # c libraries
- make gcc lib32stdc++6 lib32z1 # (incl. 32-bit compatible versions)
+ # ndk dependencies
+ make gcc file lib32stdc++6 lib32z1 # (incl. 32-bit compatible versions)
# Set Locale
RUN locale-gen en_US.UTF-8
@@ -41,6 +25,9 @@ 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_SDK_VERSION "25.2.5"
+ENV ANDROID_HOME /opt/android-sdk-linux
+ENV ANDROID_SDK_URL https://dl.google.com/android/repository/tools_r${ANDROID_SDK_VERSION}-linux.zip
# Install SDK Tools
RUN curl -L $ANDROID_SDK_URL -o sdk-tools.zip \
@@ -53,36 +40,22 @@ ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}
# ------------------------------------------------------
# --- Install Android NDK (for running C code)
+# NOTE(@aguestuser|4.23.17)
+# We woud like to use te current version of Android NDK (r14b) but cannot
+# due to pinned dependency on year-old version of `ics-openvpn`
+# which has transitive dependency on `openssl` which will not compile with `clang`
+# (starting in 13b, android ndk uses `clang` isntead of `gcc`)
+# Upon rebasing onto to current HEAD of `ics-openvpn` and resolving conflicts, we
+# should update to current version of `ndk` (if possible).
+
+ENV ANDROID_NDK_VERSION "r12b"
+ENV ANDROID_NDK_HOME ${ANDROID_HOME}/android-ndk-${ANDROID_NDK_VERSION}
+ENV ANDROID_NDK_URL http://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip
+
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}
# ------------------------------------------------------