summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-24 15:27:40 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-25 13:18:41 -0700
commitd3e495efd006abe5af03e396499bfcf60135a3e2 (patch)
treea324df8f3b65e560af19848d06003d619dae7f52
parentf112be7a619e93e20341d1ed92681cd8077e2798 (diff)
downloadsubsurface-d3e495efd006abe5af03e396499bfcf60135a3e2.tar.gz
build-system/Android: use PREFIX outside of NDK
If we install our support libraries into the NDK we later run into include path order issues that result in strange errors around the inclusion of math.h (because we find the C version of that include file that ships with the NDK before we find the libstdc++ version of math.h (because the include path for our support libraries is listed before the libstdc++ include search path). By having a distinct install-root for our libraries we can avoid this problem. Remove the previous hack that tried to work around the symptoms of this issue. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rwxr-xr-xpackaging/android/build.sh12
-rw-r--r--scripts/docker/android-build-container/Dockerfile4
2 files changed, 7 insertions, 9 deletions
diff --git a/packaging/android/build.sh b/packaging/android/build.sh
index d91df58b0..42d208587 100755
--- a/packaging/android/build.sh
+++ b/packaging/android/build.sh
@@ -143,9 +143,11 @@ fi
if [ ! -e ndk-"$ARCH" ] ; then
"$ANDROID_NDK_ROOT/build/tools/make_standalone_toolchain.py" --arch="$ARCH" --install-dir=ndk-"$ARCH" --api=$ANDROID_PLATFORM_LEVEL
fi
+
export BUILDROOT=$PWD
+mkdir -p "${BUILDROOT}"/install-root-"${ARCH}"
+export PREFIX="${BUILDROOT}"/install-root-"${ARCH}"
export PATH=${BUILDROOT}/ndk-$ARCH/bin:$PATH
-export PREFIX=${BUILDROOT}/ndk-$ARCH/sysroot/usr
export PKG_CONFIG_LIBDIR=$PREFIX/lib/pkgconfig
export CC=${BUILDROOT}/ndk-$ARCH/bin/clang
export CXX=${BUILDROOT}/ndk-$ARCH/bin/clang++
@@ -261,7 +263,7 @@ if [ "$QUICK" = "" ] ; then
popd
fi
-"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libzip
+ "${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libzip
if [ ! -e "$PKG_CONFIG_LIBDIR/libzip.pc" ] ; then
# libzip expects a predefined macro that isn't there for our compiler
pushd libzip
@@ -302,7 +304,7 @@ if [ "$QUICK" = "" ] ; then
-DUSE_SSH=OFF \
-DOPENSSL_SSL_LIBRARY="$PREFIX"/lib/libssl_1_1.so \
-DOPENSSL_CRYPTO_LIBRARY="$PREFIX"/lib/libcrypto_1_1.so \
- -DOPENSSL_INCLUDE_DIR="$PREFIX"/include/openssl \
+ -DOPENSSL_INCLUDE_DIR="$PREFIX"/include \
-D_OPENSSL_VERSION="${OPENSSL_VERSION}" \
-DCMAKE_DISABLE_FIND_PACKAGE_HTTP_Parser=TRUE \
../libgit2/
@@ -407,8 +409,8 @@ cmake $MOBILE_CMAKE \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DMAKE_TESTS=OFF \
-DFTDISUPPORT=OFF \
- -DANDROID_NATIVE_LIBSSL="$BUILDROOT/ndk-$ARCH/sysroot/usr/lib/libssl_1_1.so" \
- -DANDROID_NATIVE_LIBCRYPT="$BUILDROOT/ndk-$ARCH/sysroot/usr/lib/libcrypto_1_1.so" \
+ -DANDROID_NATIVE_LIBSSL="$PREFIX/lib/libssl_1_1.so" \
+ -DANDROID_NATIVE_LIBCRYPT="$PREFIX/lib/libcrypto_1_1.so" \
-DCMAKE_MAKE_PROGRAM="make" \
"$SUBSURFACE_SOURCE"
diff --git a/scripts/docker/android-build-container/Dockerfile b/scripts/docker/android-build-container/Dockerfile
index 509443f85..1fcc1aa76 100644
--- a/scripts/docker/android-build-container/Dockerfile
+++ b/scripts/docker/android-build-container/Dockerfile
@@ -37,10 +37,6 @@ RUN cd /android/cmake-3.13.2 && \
# run the build wrapper in prep mode
RUN cd /android && bash -x /android/android-build-wrapper.sh -prep-only
-# uggly hack to work around some breakage in the NDK which makes our
-# compiles fail
-#RUN sed -i '313,+13s/^using/\/\/using/' /android/android-ndk-r21/sources/cxx-stl/llvm-libc++/include/cmath
-
# clean up the files that we don't need to keep the container smaller
RUN cd /android && \
apt-get remove -y gcc g++-7 libstdc++-7-dev && \