aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/lib/gluegen-cpptasks-android-aarch64.xml13
-rw-r--r--make/lib/gluegen-cpptasks-android-armv6.xml13
-rw-r--r--make/lib/gluegen-cpptasks-android-x86.xml13
-rw-r--r--make/scripts/setenv-android-tools.sh52
4 files changed, 57 insertions, 34 deletions
diff --git a/make/lib/gluegen-cpptasks-android-aarch64.xml b/make/lib/gluegen-cpptasks-android-aarch64.xml
index ef4d9ff..7248d7a 100644
--- a/make/lib/gluegen-cpptasks-android-aarch64.xml
+++ b/make/lib/gluegen-cpptasks-android-aarch64.xml
@@ -33,16 +33,12 @@
<target name="gluegen.cpptasks.configure.compiler" depends="setup.java.home.dir,declare.linux.android">
<echo message="Custom forced compiler Android NDK, linker.cfg.android" />
<compiler id="compiler.cfg.android" name="clang">
- <compilerarg value="--sysroot=${env.ANDROID_TOOLCHAIN_SYSROOT1}" /> <!-- include files, but libs not in std FS layout -->
- <compilerarg value="-stdlib=libstdc++"/>
- <compilerarg value="-isysroot"/>
- <compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1}" />
+ <!-- compilerarg value="-isystem"/> LLVM's C++ STL
+ <compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC_STL}" / -->
<compilerarg value="-isystem"/>
<compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC}" />
<compilerarg value="-isystem"/>
<compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH}" />
- <compilerarg value="-isystem"/>
- <compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC}/c++/v1" />
<compilerarg value="-v" />
@@ -94,8 +90,9 @@
<linker id="linker.cfg.android" name="clang">
<linkerarg value="--sysroot=${env.ANDROID_TOOLCHAIN_SYSROOT0}" /> <!-- libs in std FS layout, but no include files -->
- <linkerarg value="-L${env.ANDROID_TOOLCHAIN_SYSROOT0_LIB}" />
- <linkerarg value="-Wl,-rpath-link=${env.ANDROID_TOOLCHAIN_SYSROOT0_LIB}" />
+ <linkerarg value="-L${env.ANDROID_TOOLCHAIN_SYSROOT1_LIB1}" />
+ <linkerarg value="-Wl,-rpath-link=${env.ANDROID_TOOLCHAIN_SYSROOT1_LIB1}" />
+ <linkerarg value="-L${env.ANDROID_TOOLCHAIN_SYSROOT1_LIB2}" />
<linkerarg value="-v" />
diff --git a/make/lib/gluegen-cpptasks-android-armv6.xml b/make/lib/gluegen-cpptasks-android-armv6.xml
index fd8109c..ca95a96 100644
--- a/make/lib/gluegen-cpptasks-android-armv6.xml
+++ b/make/lib/gluegen-cpptasks-android-armv6.xml
@@ -33,16 +33,12 @@
<target name="gluegen.cpptasks.configure.compiler" depends="setup.java.home.dir,declare.linux.android">
<echo message="Custom forced compiler Android NDK, linker.cfg.android" />
<compiler id="compiler.cfg.android" name="clang">
- <compilerarg value="--sysroot=${env.ANDROID_TOOLCHAIN_SYSROOT1}" /> <!-- include files, but libs not in std FS layout -->
- <compilerarg value="-stdlib=libstdc++"/>
- <compilerarg value="-isysroot"/>
- <compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1}" />
+ <!-- compilerarg value="-isystem"/> LLVM's C++ STL
+ <compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC_STL}" / -->
<compilerarg value="-isystem"/>
<compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC}" />
<compilerarg value="-isystem"/>
<compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH}" />
- <compilerarg value="-isystem"/>
- <compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC}/c++/v1" />
<compilerarg value="-v" />
@@ -96,8 +92,9 @@
<linker id="linker.cfg.android" name="clang">
<linkerarg value="--sysroot=${env.ANDROID_TOOLCHAIN_SYSROOT0}" /> <!-- libs in std FS layout, but no include files -->
- <linkerarg value="-L${env.ANDROID_TOOLCHAIN_SYSROOT0_LIB}" />
- <linkerarg value="-Wl,-rpath-link=${env.ANDROID_TOOLCHAIN_SYSROOT0_LIB}" />
+ <linkerarg value="-L${env.ANDROID_TOOLCHAIN_SYSROOT1_LIB1}" />
+ <linkerarg value="-Wl,-rpath-link=${env.ANDROID_TOOLCHAIN_SYSROOT1_LIB1}" />
+ <linkerarg value="-L${env.ANDROID_TOOLCHAIN_SYSROOT1_LIB2}" />
<linkerarg value="-v" />
diff --git a/make/lib/gluegen-cpptasks-android-x86.xml b/make/lib/gluegen-cpptasks-android-x86.xml
index baedfc1..8b53635 100644
--- a/make/lib/gluegen-cpptasks-android-x86.xml
+++ b/make/lib/gluegen-cpptasks-android-x86.xml
@@ -32,16 +32,12 @@
<target name="gluegen.cpptasks.configure.compiler" depends="setup.java.home.dir,declare.linux.android">
<echo message="Custom forced compiler Android NDK, linker.cfg.android" />
<compiler id="compiler.cfg.android" name="clang">
- <compilerarg value="--sysroot=${env.ANDROID_TOOLCHAIN_SYSROOT1}" /> <!-- include files, but libs not in std FS layout -->
- <compilerarg value="-stdlib=libstdc++"/>
- <compilerarg value="-isysroot"/>
- <compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1}" />
+ <!-- compilerarg value="-isystem"/> LLVM's C++ STL
+ <compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC_STL}" / -->
<compilerarg value="-isystem"/>
<compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC}" />
<compilerarg value="-isystem"/>
<compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH}" />
- <compilerarg value="-isystem"/>
- <compilerarg value="${env.ANDROID_TOOLCHAIN_SYSROOT1_INC}/c++/v1" />
<compilerarg value="-v" />
@@ -91,8 +87,9 @@
<linker id="linker.cfg.android" name="clang">
<linkerarg value="--sysroot=${env.ANDROID_TOOLCHAIN_SYSROOT0}" /> <!-- libs in std FS layout, but no include files -->
- <linkerarg value="-L${env.ANDROID_TOOLCHAIN_SYSROOT0_LIB}" />
- <linkerarg value="-Wl,-rpath-link=${env.ANDROID_TOOLCHAIN_SYSROOT0_LIB}" />
+ <linkerarg value="-L${env.ANDROID_TOOLCHAIN_SYSROOT1_LIB1}" />
+ <linkerarg value="-Wl,-rpath-link=${env.ANDROID_TOOLCHAIN_SYSROOT1_LIB1}" />
+ <linkerarg value="-L${env.ANDROID_TOOLCHAIN_SYSROOT1_LIB2}" />
<linkerarg value="-v" />
diff --git a/make/scripts/setenv-android-tools.sh b/make/scripts/setenv-android-tools.sh
index e507940..477a66a 100644
--- a/make/scripts/setenv-android-tools.sh
+++ b/make/scripts/setenv-android-tools.sh
@@ -45,7 +45,9 @@
# - ANDROID_TOOLCHAIN_SYSROOT1
# - ANDROID_TOOLCHAIN_SYSROOT1_INC
# - ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH
-# - ANDROID_TOOLCHAIN_SYSROOT1_LIB
+# - ANDROID_TOOLCHAIN_SYSROOT1_INC_STL
+# - ANDROID_TOOLCHAIN_SYSROOT1_LIB1
+# - ANDROID_TOOLCHAIN_SYSROOT1_LIB2
#
# Android Studio SDK + NDK Filesystem Layout (official)
#
@@ -53,6 +55,8 @@
# ~/Android/Sdk/build-tools/29.0.2/
# ~/Android/Sdk/build-tools/29.0.2/zipalign (*)
# ~/Android/Sdk/ndk/
+# ~/Android/Sdk/ndk/20.1.5948944/platforms/android-24/arch-arm64 (1)
+# ~/Android/Sdk/ndk/20.1.5948944/platforms/android-24/arch-arm64/usr/lib/libc.a (*)(1)
# ~/Android/Sdk/ndk/20.1.5948944/sysroot/ (gcc)
# ~/Android/Sdk/ndk/20.1.5948944/sysroot/usr/include/ (gcc)
# ~/Android/Sdk/ndk/20.1.5948944/sysroot/usr/lib/aarch64-linux-android/libc.a (gcc)
@@ -67,14 +71,26 @@
# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include
# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android/asm/types.h (*) (2,3)
# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc.a (*)
+# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so (*)
# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/24/libc.a (*) (2)
-# ~/Android/Sdk/ndk/20.1.5948944/platforms/android-24/arch-arm64 (1)
-# ~/Android/Sdk/ndk/20.1.5948944/platforms/android-24/arch-arm64/usr/lib/libc.a (*)(1)
+# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/complex (*) (4)
#
# (*) tested by this script
+#
# (1) ANDROID_TOOLCHAIN_SYSROOT0 exposes all libs with standard FS layout usr/lib, but no include files
+# -> ANDROID_TOOLCHAIN_SYSROOT0_LIB
+#
# (2) ANDROID_TOOLCHAIN_SYSROOT1 exposes all libs but without standard FS layout, also exposes include files
+# -> ANDROID_TOOLCHAIN_SYSROOT1_INC
+#
# (3) ANDROID_TOOLCHAIN_SYSROOT1 also exposes the arch dependent include files, i.e. asm/types.h etc
+# -> ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH
+#
+# (4) ANDROID_TOOLCHAIN_SYSROOT1_INC_STL for LLVM's C++ STL lib (default since NDK r18)
+# Using LLVM's c++_shared as of NDK r18: https://developer.android.com/ndk/guides/cpp-support.html
+# LLVM's c++ headers must come before other system header!
+# Also see https://github.com/android/ndk/issues/452 and https://gitlab.kitware.com/cmake/cmake/issues/17059
+#
# Native libraries of (1) and (2) are identical
#
# Having
@@ -155,7 +171,9 @@ echo ANDROID_TOOLCHAIN_SYSROOT0_LIB ${ANDROID_TOOLCHAIN_SYSROOT0_LIB}
echo ANDROID_TOOLCHAIN_SYSROOT1 ${ANDROID_TOOLCHAIN_SYSROOT1}
echo ANDROID_TOOLCHAIN_SYSROOT1_INC ${ANDROID_TOOLCHAIN_SYSROOT1_INC}
echo ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH ${ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH}
-echo ANDROID_TOOLCHAIN_SYSROOT1_LIB ${ANDROID_TOOLCHAIN_SYSROOT1_LIB}
+echo ANDROID_TOOLCHAIN_SYSROOT1_INC_STL ${ANDROID_TOOLCHAIN_SYSROOT1_INC_STL}
+echo ANDROID_TOOLCHAIN_SYSROOT1_LIB1 ${ANDROID_TOOLCHAIN_SYSROOT1_LIB1}
+echo ANDROID_TOOLCHAIN_SYSROOT1_LIB2 ${ANDROID_TOOLCHAIN_SYSROOT1_LIB2}
echo
check_exists() {
@@ -249,8 +267,10 @@ ANDROID_TOOLCHAIN_SYSROOT0_LIB=${ANDROID_TOOLCHAIN_SYSROOT0}/usr/lib
ANDROID_TOOLCHAIN_SYSROOT1=${ANDROID_TOOLCHAIN_ROOT}/sysroot
ANDROID_TOOLCHAIN_SYSROOT1_INC=${ANDROID_TOOLCHAIN_SYSROOT1}/usr/include
-ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH=${ANDROID_TOOLCHAIN_SYSROOT1}/usr/include/${ANDROID_TOOLCHAIN_NAME}
-ANDROID_TOOLCHAIN_SYSROOT1_LIB=${ANDROID_TOOLCHAIN_SYSROOT1}/usr/lib/${ANDROID_TOOLCHAIN_NAME}/${ANDROID_API_LEVEL}
+ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH=${ANDROID_TOOLCHAIN_SYSROOT1_INC}/${ANDROID_TOOLCHAIN_NAME}
+ANDROID_TOOLCHAIN_SYSROOT1_INC_STL=${ANDROID_TOOLCHAIN_SYSROOT1_INC}/c++/v1
+ANDROID_TOOLCHAIN_SYSROOT1_LIB1=${ANDROID_TOOLCHAIN_SYSROOT1}/usr/lib/${ANDROID_TOOLCHAIN_NAME}/${ANDROID_API_LEVEL}
+ANDROID_TOOLCHAIN_SYSROOT1_LIB2=${ANDROID_TOOLCHAIN_SYSROOT1}/usr/lib/${ANDROID_TOOLCHAIN_NAME}
# ~/Android/Sdk/build-tools/29.0.2/zipalign (*)
check_exists ${ANDROID_BUILDTOOLS_ROOT}/zipalign
@@ -267,8 +287,16 @@ check_exists ${ANDROID_TOOLCHAIN_SYSROOT0_LIB}/libc.a
# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android/asm/types.h (*) (2)
check_exists ${ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH}/asm/types.h
+# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/complex (*) (4)
+check_exists ${ANDROID_TOOLCHAIN_SYSROOT1_INC_STL}/complex
+
# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/24/libc.a (*)
-check_exists ${ANDROID_TOOLCHAIN_SYSROOT1_LIB}/libc.a
+check_exists ${ANDROID_TOOLCHAIN_SYSROOT1_LIB1}/libc.a
+
+# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc.a (*)
+# ~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so (*)
+check_exists ${ANDROID_TOOLCHAIN_SYSROOT1_LIB2}/libc.a
+check_exists ${ANDROID_TOOLCHAIN_SYSROOT1_LIB2}/libc++_shared.so
export ANDROID_HOME
export ANDROID_API_LEVEL
@@ -288,8 +316,10 @@ export ANDROID_TOOLCHAIN_SYSROOT0
export ANDROID_TOOLCHAIN_SYSROOT0_LIB
export ANDROID_TOOLCHAIN_SYSROOT1
export ANDROID_TOOLCHAIN_SYSROOT1_INC
-export ANDROID_TOOLCHAIN_SYSROOT1_ARCH
-export ANDROID_TOOLCHAIN_SYSROOT1_LIB
+export ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH
+export ANDROID_TOOLCHAIN_SYSROOT1_INC_STL
+export ANDROID_TOOLCHAIN_SYSROOT1_LIB1
+export ANDROID_TOOLCHAIN_SYSROOT1_LIB2
echo "Postset-0 (user)"
echo ANDROID_HOME ${ANDROID_HOME}
@@ -313,7 +343,9 @@ echo ANDROID_TOOLCHAIN_SYSROOT0_LIB ${ANDROID_TOOLCHAIN_SYSROOT0_LIB}
echo ANDROID_TOOLCHAIN_SYSROOT1 ${ANDROID_TOOLCHAIN_SYSROOT1}
echo ANDROID_TOOLCHAIN_SYSROOT1_INC ${ANDROID_TOOLCHAIN_SYSROOT1_INC}
echo ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH ${ANDROID_TOOLCHAIN_SYSROOT1_INC_ARCH}
-echo ANDROID_TOOLCHAIN_SYSROOT1_LIB ${ANDROID_TOOLCHAIN_SYSROOT1_LIB}
+echo ANDROID_TOOLCHAIN_SYSROOT1_INC_STL ${ANDROID_TOOLCHAIN_SYSROOT1_INC_STL}
+echo ANDROID_TOOLCHAIN_SYSROOT1_LIB1 ${ANDROID_TOOLCHAIN_SYSROOT1_LIB1}
+echo ANDROID_TOOLCHAIN_SYSROOT1_LIB2 ${ANDROID_TOOLCHAIN_SYSROOT1_LIB2}
echo
export -p | grep ANDROID