[New-bugs-announce] [issue27453] Fix cross-compilation with Android NDK and Clang

Chi Hsuan Yen report at bugs.python.org
Tue Jul 5 07:18:43 EDT 2016


New submission from Chi Hsuan Yen:

Motivation: Android NDK is deprecating GCC and moving ot Clang/LLVM. From [1]:

We strongly recommend switching to Clang.
GCC in the NDK is now deprecated in favor of Clang.

This patch fixes the only one problem when migrating GCC to Clang.

In my build script, $CPP is set to "${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -E" and $CPPFLAGS is set to "-target armv7-none-linux-androideabi -gcc-toolchain ${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot ${ANDROID_NDK}/platforms/android-21/arch-arm/usr -I${PREFIX}/include -DANDROID". I'm not sure whether it's the correct usage of clang, but at least it works.

With such a configuration, most Python parts builds well. Just something wrong - extensions as built as xyz.cpython-36m-x86_64-linux-gnu.so. My patch just fixes $(PLATFORM_TRIPLET) detection.

[1] https://developer.android.com/ndk/downloads/revision_history.html

----------
components: Cross-Build
files: ndk-clang-preprocessor.patch
keywords: patch
messages: 269816
nosy: Alex.Willmer, Chi Hsuan Yen, xdegaye
priority: normal
severity: normal
status: open
title: Fix cross-compilation with Android NDK and Clang
type: compile error
versions: Python 3.6
Added file: http://bugs.python.org/file43625/ndk-clang-preprocessor.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27453>
_______________________________________


More information about the New-bugs-announce mailing list