p4a build fails due to clang not recognizing '-mandroid'

36 views
Skip to first unread message

Michel Müller

unread,
Oct 5, 2018, 11:13:48 AM10/5/18
to Kivy users support
Hi everyone

My p4a apk builds unfortunately run into an error when trying to build python2 for the device. I have the following setup: 

SDK 22; NDK 18; Build-tools 28; python-for-android 0.6.0

I'm trying to run a p4a build as follows: 

p4a apk \
--sdk_dir=$ANDROID_HOME \
--ndk_dir=$ANDROID_NDK \
--android_api=$ANDROID_SDK_VERSION \
--ndk_version=$ANDROID_NDK_VERSION \
--private webp \
--permission=ACCESS_NETWORK_STATE \
--permission=WRITE_EXTERNAL_STORAGE \
--orientation=sensor \
--permission=INTERNET \
--version=227.1 \
--package=$PACKAGE_NAME \
--name="webp" \
--arch=${arch} \
--bootstrap=webview \
--port=5000 \
--requirements=flask,pyjnius \
--debug \
--add-jar sqlcclasses.jar --add-jar sqlcusclasses.jar --add-jar forestdbclasses.jar --add-jar cblclasses.jar --add-jar classes.jar --add-jar commons-io-2.0.1.jar --add-jar couchbase-lite-java-core-1.4-28.jar --add-jar couchbase-lite-java-javascript-1.4-28.jar --add-jar couchbase-lite-java-listener-1.4-28.jar --add-jar jackson-annotations-2.5.0.jar --add-jar jackson-core-2.5.0.jar --add-jar jackson-databind-2.5.0.jar --add-jar okhttp-3.3.1.jar --add-jar okio-1.8.0.jar --add-jar rhino-1.7R3.jar --add-jar servlet-2-3.jar --add-jar stateless4j-2.4.0.jar \

This runs the hostpython compilation fine, after which python2 errors out in the configure phase: 

[INFO]:    -> directory context /home/muellermichel/.local/share/python-for-android/build/other_builds/python2/armeabi-v7a/python2
[DEBUG]:   -> running cp /usr/local/lib/python2.7/dist-packages/pythonforandroid/recipes/hostpython2/Setup Modules
[DEBUG]:   -> running gcc -dumpmachine
[DEBUG]:        x86_64-linux-gnu
[DEBUG]:   -> running configure --host=arm-eabi --build=x86_64-linux-gnu --prefix=/home/muellermichel/.local/share/python-for-android/build/other_builds/python2/armeabi-v7a/python2/python-install --enable-shared --disable-toolbox-glue --disable-framework
[DEBUG]:        checking for --enable-universalsdk... no
[DEBUG]:        checking for --with-universal-archs... 32-bit
[DEBUG]:        checking MACHDEP... linux4
[DEBUG]:        checking EXTRAPLATDIR...
[DEBUG]:        checking machine type as reported by uname -m... x86_64
[DEBUG]:        checking for --without-gcc... no
[DEBUG]:        checking for arm-eabi-gcc... arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=22 -isystem /usr/lib/android-ndk-r18/sysroot/usr/include/arm-linux-androideabi -isysroot /usr/lib/android-ndk-r18/sysroot -I/home/muellermichel/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python2.7
[DEBUG]:        checking whether the C compiler works... no
[DEBUG]:        configure: error: in `/home/muellermichel/.local/share/python-for-android/build/other_builds/python2/armeabi-v7a/python2':
[DEBUG]:        configure: error: C compiler cannot create executables
[DEBUG]:        See `config.log' for more details
(...)

The config.log is attached. The gist of it is that it tries to use clang together with '-mandroid'. This produces a variation of the error also described in https://github.com/android-ndk/ndk/issues/5. By the way, when I try to run the same ./configure command as printed manually it works fine - however in that case it uses my host machine's gcc instead of clang that seems to come with Android's build tools.

My question: Is this a problem with my combination of build-tools/NDK/SDK? I couldn't find any documentation about what combination the maintainers are testing with. If someone has a working combo, could you share? Thanks in advance!

Best,

Michel
config.log.error

Michel Müller

unread,
Oct 10, 2018, 5:42:36 AM10/10/18
to Kivy users support
I've just tried with SDK 19 as well, didn't make a difference. Any ideas?
Reply all
Reply to author
Forward
0 new messages