Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO-NOT-MERGE: debug android CI #1225

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions packaging/android/android-build-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ USE_X=$(case $- in *x*) echo "-x" ;; esac)

QT_VERSION=5.10
LATEST_QT=5.10.1
NDK_VERSION=r14b
NDK_VERSION=r16b
SDK_VERSION=3859397 # if you change this version, you'll likely have to change the android-sdk-license key fallback below

ANDROID_NDK=android-ndk-${NDK_VERSION}
Expand All @@ -46,7 +46,7 @@ fi

# make sure we have the required commands installed
MISSING=
for i in git cmake autoconf libtool java ant wget unzip; do
for i in git cmake autoconf libtool java ant wget unzip makedepend; do
command -v $i >/dev/null ||
if [ $i = libtool ] ; then
MISSING="${MISSING}libtool-bin "
Expand Down Expand Up @@ -77,6 +77,9 @@ if [ ! -d $ANDROID_SDK ] ; then
mkdir $ANDROID_SDK
pushd $ANDROID_SDK
unzip -q ../$SDK_TOOLS
mkdir -p licenses
# use this fix from https://stackoverflow.com/a/47150411 or sdkmanager throws Java exceptions
export SDKMANAGER_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
yes | tools/bin/sdkmanager --licenses > /dev/null 2>&1 || echo "d56f5187479451eabf01fb78af6dfcb131a6481e" > licenses/android-sdk-license
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the weird thing is that this last line after the '||' already tries to manually force a license. I assume that key is no longer valid or something?
If your solution works more reliably, even better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the export made the call before || work.

cat licenses/android-sdk-license
echo ""
Expand Down
33 changes: 24 additions & 9 deletions packaging/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ SUBSURFACE_DESKTOP=OFF
ARCH=arm
# Which SDK buildtools revision is used?
ANDROID_BUILDTOOLS_REVISION=25.0.3
ANDROID_API=16

while [ "$#" -gt 0 ] ; do
case "$1" in
Expand Down Expand Up @@ -76,7 +77,7 @@ done
export ARCH

# Configure where we can find things here
export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT-$SUBSURFACE_SOURCE/../android-ndk-r14b}
export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT-$SUBSURFACE_SOURCE/../android-ndk-r16b}

if [ -n "${QT5_ANDROID+X}" ] ; then
echo "Using Qt5 in $QT5_ANDROID"
Expand Down Expand Up @@ -142,14 +143,16 @@ else
fi

if [ ! -e ndk-"$ARCH" ] ; then
"$ANDROID_NDK_ROOT/build/tools/make_standalone_toolchain.py" --arch="$ARCH" --install-dir=ndk-"$ARCH" --api=16
"$ANDROID_NDK_ROOT/build/tools/make_standalone_toolchain.py" --arch="$ARCH" --install-dir=ndk-"$ARCH" --api="$ANDROID_API"
fi
export BUILDROOT=$PWD
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/${BUILDCHAIN}-gcc
export CXX=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-g++
CC_NAME=clang
CXX_NAME=clang++
export CC=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-${CC_NAME}
export CXX=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-${CXX_NAME}
# autoconf seems to get lost without this
export SYSROOT=${BUILDROOT}/ndk-$ARCH/sysroot
export CFLAGS=--sysroot=${SYSROOT}
Expand All @@ -164,7 +167,6 @@ else
export JAVA_HOME=/usr
fi


# find qmake
QMAKE=$QT5_ANDROID/android_armv7/bin/qmake
$QMAKE -query
Expand Down Expand Up @@ -255,6 +257,10 @@ if [ ! -e "$PKG_CONFIG_LIBDIR/libzip.pc" ] ; then
mkdir -p libzip-build-"$ARCH"
pushd libzip-build-"$ARCH"
../libzip-${LIBZIP_VERSION}/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --enable-static --disable-shared
# the build fails with missing fts_*() functions in the NDK toolchains.
# cmake cannot find ZLIB while configure decides that HAVE_FTS_H should be set.
# hack: use configure but replace the HAVE_FTS_H macro with HAVE_FTS_H__ to ignore fts_*()
sed -i 's/HAVE_FTS_H/HAVE_FTS_H__/' ../libzip-${LIBZIP_VERSION}/src/zipcmp.c
make
make install
popd
Expand All @@ -274,12 +280,18 @@ if [ ! -e "$PKG_CONFIG_LIBDIR/libssl.pc" ] ; then
env SYSTEM=android \
CROSS_COMPILE=${BUILDCHAIN}- \
MACHINE=$OPENSSL_MACHINE \
HOSTCC=gcc \
CC=gcc \
HOSTCC=${CC_NAME} \
CC=${CC_NAME} \
ANDROID_DEV="$PREFIX" \
bash -x ./config shared no-ssl2 no-ssl3 no-comp no-hw no-engine --openssldir="$PREFIX"
bash -x ./config shared no-ssl2 no-ssl3 no-comp no-hw no-engine no-asm --openssldir="$PREFIX"
# sed -i.bak -e 's/soname=\$\$SHLIB\$\$SHLIB_SOVER\$\$SHLIB_SUFFIX/soname=\$\$SHLIB/g' Makefile.shared
make depend
# remove the -mandroid flag for clang as it's not supported
# also remove all _ASM defines as those throw errors
if [ ${CC_NAME} = "clang" ]; then
sed -i 's/-mandroid//' Makefile
# sed -i 's/-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM//' Makefile
fi
make
# now fix the reference to libcrypto.so.1.0.0 to be just to libcrypto.so
perl -pi -e 's/libcrypto.so.1.0.0/libcrypto.so\x00\x00\x00\x00\x00\x00/' libssl.so.1.0.0
Expand All @@ -302,6 +314,7 @@ if [ ! -e "$PKG_CONFIG_LIBDIR/libgit2.pc" ] ; then
mkdir -p libgit2-build-"$ARCH"
pushd libgit2-build-"$ARCH"
cmake -DCMAKE_SYSTEM_NAME=Android -DSHA1_TYPE=builtin \
-DCMAKE_C_FLAGS=-D__ANDROID_API__="$ANDROID_API" \
-DBUILD_CLAR=OFF -DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DCURL=OFF \
Expand Down Expand Up @@ -355,7 +368,7 @@ fi
if [ ! -e "$PKG_CONFIG_LIBDIR/libftdi1.pc" ] && [ "$PLATFORM" != "Darwin" ] ; then
mkdir -p libftdi1-build-"$ARCH"
pushd libftdi1-build-"$ARCH"
cmake ../libftdi1-${LIBFTDI_VERSION} -DCMAKE_C_COMPILER="$CC" -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" -DSTATICLIBS=ON -DPYTHON_BINDINGS=OFF -DDOCUMENTATION=OFF -DFTDIPP=OFF -DBUILD_TESTS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF
cmake ../libftdi1-${LIBFTDI_VERSION} -CMAKE_C_FLAGS=-D__ANDROID_API__="$ANDROID_API" -DCMAKE_C_COMPILER="$CC" -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" -DSTATICLIBS=ON -DPYTHON_BINDINGS=OFF -DDOCUMENTATION=OFF -DFTDIPP=OFF -DBUILD_TESTS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF
make
make install
popd
Expand Down Expand Up @@ -427,6 +440,8 @@ fi

PKGCONF=$(which pkg-config)
cmake $MOBILE_CMAKE \
-DCMAKE_C_FLAGS=-D__ANDROID_API__="$ANDROID_API" \
-DCMAKE_CXX_FLAGS=-D__ANDROID_API__="$ANDROID_API" \
-DPKG_CONFIG_EXECUTABLE="$PKGCONF" \
-DQT_ANDROID_SDK_ROOT="$ANDROID_SDK_ROOT" \
-DQT_ANDROID_NDK_ROOT="$ANDROID_NDK_ROOT" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/android/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ git describe
docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d ubuntu /bin/sleep 60m
docker exec -t builder apt-get update
# subsurface android build dependencies
docker exec -t builder apt-get install -y git cmake autoconf libtool-bin openjdk-8-jdk-headless ant wget unzip python bzip2 pkg-config
docker exec -t builder apt-get install -y git cmake autoconf libtool-bin openjdk-8-jdk-headless ant wget unzip python bzip2 pkg-config xutils-dev
# Qt installer dependencies
docker exec -t builder apt-get install -y libx11-xcb1 libgl1-mesa-glx libglib2.0-0
# Inject cached 3pp's (if none exists in 3pp dir, we inject zero ones, and all is downloaded in the container)
Expand Down