Compilation error using buildozer. NDK location issue - android

I have buildozer installed but I can't compile an apk. I am on windows so I have an Ubuntu 64 bits VM with oracle VM.
I donwload and install again cython, and configure several previous errors to be able to use python_for_android.
When I try to run the buildozer android debug command I get the next result
Welcome to the Buildozer Virtual Machine.
Please see ~/Desktop/README.txt for more information
kivy#kivy-VirtualBox:~/Desktop/Kivy_apps/HelloKivy$ buildozer android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian `dpkg' package management program version 1.17.5 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
# -> found at /usr/bin/git
# Search for Cython (cython)
# -> found at /usr/local/bin/cython
# Search for Java compiler (javac)
# -> found at /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
# -> found at /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
# Install platform
# Run 'ln -sf /usr/local/lib/python2.7/dist-packages/python-for-android ./python-for-android'
# Cwd /home/kivy/Desktop/Kivy_apps/HelloKivy/.buildozer/android/platform
# Apache ANT found at /home/kivy/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/kivy/.buildozer/android/platform/android-sdk-21
# Android NDK found at /home/kivy/.buildozer/android/platform/android-ndk-r9c
# Check application requirements
# Run './distribute.sh -l'
# Cwd /home/kivy/Desktop/Kivy_apps/HelloKivy/.buildozer/android/platform/python-for-android
Available modules: android apsw audiostream bidi boost cherrypy c_igraph cprotobuf cymunk django docutils ecdsa enum34 evdev ffmpeg ffmpeg2 ffpyplayer freetype gevent greenlet harfbuzz hostpython igraph jpeg kivent_core kivent_cymunk kivy leveldb libevent libpq libsodium libswift libtorrent libxml2 libxslt libyaml lxml m2crypto midistream msgpack mysql_connector netifaces numpy opencv openssl paramiko pil plyer plyvel png polygon protobuf psutil psycopg2 pyasn1 pycrypto pygame pyjnius pylibpd pyopenssl pyparsing pyqrcode python pyyaml sdl setuptools six sqlalchemy sqlite3 storm swift thrift twisted txws wokkel zeroconf zope
# Application requirements already installed, pass
# Check garden requirements
# Compile platform
# Run './distribute.sh -l'
# Cwd /home/kivy/Desktop/Kivy_apps/HelloKivy/.buildozer/android/platform/python-for-android
Available modules: android apsw audiostream bidi boost cherrypy c_igraph cprotobuf cymunk django docutils ecdsa enum34 evdev ffmpeg ffmpeg2 ffpyplayer freetype gevent greenlet harfbuzz hostpython igraph jpeg kivent_core kivent_cymunk kivy leveldb libevent libpq libsodium libswift libtorrent libxml2 libxslt libyaml lxml m2crypto midistream msgpack mysql_connector netifaces numpy opencv openssl paramiko pil plyer plyvel png polygon protobuf psutil psycopg2 pyasn1 pycrypto pygame pyjnius pylibpd pyopenssl pyparsing pyqrcode python pyyaml sdl setuptools six sqlalchemy sqlite3 storm swift thrift twisted txws wokkel zeroconf zope
# Clean and build python-for-android
# Run './distribute.sh -m "kivy" -d "myapp"'
# Cwd /home/kivy/Desktop/Kivy_apps/HelloKivy/.buildozer/android/platform/python-for-android
Check build dependencies for Ubuntu
Check environment
SDK located at /home/kivy/.buildozer/android/platform/android-sdk-21
NDK located at /home/kivy/.buildozer/android/platform/android-ndk-r9c
NDK version is r9c
API level set to 14
Check NDK location
Check mandatory tools
Distribution will be located at /usr/local/lib/python2.7/dist-packages/python-for-android/dist/myapp
Entering in ARM environment
Compiler found at /home/kivy/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin//arm-linux-androideabi-gcc
PATH is /home/kivy/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/:/home/kivy/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/:/home/kivy/.buildozer/android/platform/android-ndk-r9c:/home/kivy/.buildozer/android/platform/android-sdk-21/tools:/home/kivy/.buildozer/android/platform/apache-ant-1.9.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Leaving ARM environment
Read kivy recipe
Module kivy depend on pygame pyjnius android
Read pygame recipe
Module pygame depend on python sdl
Read pyjnius recipe
Module pyjnius depend on python sdl
Read android recipe
Module android depend on pygame
Read python recipe
Module python depend on hostpython
Read sdl recipe
Module sdl depend on python
Ignored python, already processed
Ignored sdl, already processed
Ignored pygame, already processed
Read hostpython recipe
Ignored python, already processed
Modules changed to hostpython python sdl pygame pyjnius android kivy
Pure-Python modules changed to
Run get packages
Download package for hostpython
Module hostpython already downloaded
Download package for python
Module python already downloaded
Download package for sdl
No package for sdl
Download package for pygame
Module pygame already downloaded
Download package for pyjnius
Module pyjnius already downloaded
Download package for android
No package for android
Download package for kivy
Module kivy already downloaded
Run prebuild
Call prebuild_hostpython
Call prebuild_python
Call prebuild_sdl
Call prebuild_pygame
Call prebuild_pyjnius
Call prebuild_android
Call prebuild_kivy
Run build
Skipped build_hostpython
Call build_python
Entering in ARM environment
Compiler found at /home/kivy/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin//arm-linux-androideabi-gcc
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux3
checking EXTRAPLATDIR...
[...]
creating Modules/Setup
creating Modules/Setup.local
creating Makefile
./configure --host=arm-eabi --build=x86_64-linux-gnu OPT= --prefix=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install --enable-shared --disable-toolbox-glue --disable-framework
[...]
cp: cannot stat ‘HOSTPYTHON=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2/hostpython’: No such file or directory
First install (failing..)
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -c -fno-strict-aliasing -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -DNDEBUG -I. -IInclude -I./Include -fPIC -DPy_BUILD_CORE -DPYTHONPATH='":plat-linux3:lib-tk:lib-old"' \
-DPREFIX='"/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install"' \
-DEXEC_PREFIX='"/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install"' \
-DVERSION='"2.7"' \
-DVPATH='""' \
-o Modules/getpath.o ./Modules/getpath.c
# Substitution happens here, as the completely-expanded BINDIR
# is not available in configure
/usr/bin/install -c -m 644 ./Include/Python-ast.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
sed -e "s,#EXENAME#,/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin/python2.7," < ./Misc/python-config.in >python-config
/usr/bin/install -c -m 644 ./Misc/python.man \
/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/share/man/man1/python2.7.1
/usr/bin/install -c -m 644 ./Include/Python.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/
[...]
/usr/bin/install -c -m 644 ./Include/osdefs.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
rm -f libpython2.7.a
if test libpython2.7.so != libpython2.7.so; then \
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -shared -lm -Wl,-hlibpython2.7.so -o libpython2.7.so Modules/getbuildinfo.
[...]
Modules/xmltok.o Modules/pyexpat.o Modules/xxsubtype.o -L/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib -lz -ldl -lm ; \
ln -f libpython2.7.so libpython2.7.so; \
else \
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -shared -lm -o libpython2.7.so Modules/getbuildinfo.o Parser/acceler.o P
[...]
cStringIO.o Modules/cPickle.o Modules/zlibmodule.o Modules/xmlparse.o Modules/xmlrole.o Modules/xmltok.o Modules/pyexpat.o Modules/xxsubtype.o -L/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib -lz -ldl -lm ; \
fi
/usr/bin/install -c -m 644 ./Include/parsetok.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
arm-linux-androideabi-ar rc libpython2.7.a Modules/getbuildinfo.o
/usr/bin/install -c -m 644 ./Include/patchlevel.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install
[...]
/usr/bin/install -c -m 644 ./Include/weakrefobject.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
/usr/bin/install -c -m 644 pyconfig.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/
[...]
Modules/xmlparse.o Modules/xmlrole.o Modules/xmltok.o Modules/pyexpat.o Modules/xxsubtype.o
arm-linux-androideabi-ranlib libpython2.7.a
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -lm -Xlinker -export-dynamic -o python \
Modules/python.o \
-L. -lpython2.7 -ldl -L/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib -lz -lm
/usr/bin/install -c python /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin/python2.7
if test -f libpython2.7.so; then \
if test -n "" ; then \
/usr/bin/install -c -m 555 /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin; \
else \
/usr/bin/install -c -m 555 libpython2.7.so /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/libpython2.7.so; \
if test libpython2.7.so != libpython2.7.so; then \
(cd /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib; ln -sf libpython2.7.so libpython2.7.so) \
fi \
fi; \
else true; \
fi
if test -f /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin/python -o -h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin/python; \
then rm -f /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin/python; \
else true; \
fi
(cd /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin; ln python2.7 python)
rm -f /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin/python-config
(cd /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin; ln -s python2.7-config python-config)
test -d /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/pkgconfig || /usr/bin/install -c -d -m 755 /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/pkgconfig
rm -f /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/pkgconfig/python.pc
(cd /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/pkgconfig; ln -s python-2.7.pc python.pc)
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _curses _curses_panel
_sqlite3 _ssl _tkinter
bsddb185 bz2 dbm
dl gdbm imageop
linuxaudiodev nis ossaudiodev
readline spwd sunaudiodev
zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
running build_scripts
CC='arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm' LDSHARED='arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -shared -lm' OPT='-DNDEBUG ' \
LD_LIBRARY_PATH=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2: /usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2/hostpython -E ./setup.py install \
--skip-build \
--prefix=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install \
--install-scripts=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin \
--install-platlib=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/lib-dynload \
--root=/
Creating directory /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/lib-tk/test/test_tkinter
[...]
/usr/bin/install -c -m 644 ./Lib/BaseHTTPServer.py /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7
copying build/scripts-2.7/2to3 -> /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin
/usr/bin/install -c -m 644 ./Lib/Bastion.py /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7
changing mode of /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin/pydoc to 775
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/lib-dynload/Python-2.7.2-py2.7.egg-info
Writing /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/lib-dynload/Python-2.7.2-py2.7.egg-info
/usr/bin/install -c -m 644 ./Lib/ConfigParser.py /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7
/usr/bin/install -c -m 644 ./Lib/Cookie.py /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7
/usr/bin/install -c -m 644 ./Lib/DocXMLRPCServer.py /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7
/usr/bin/install -c -m 644 ./Lib/compileall.py /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7
[...]
/usr/bin/install -c ./Lib/plat-linux3/regen /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/plat-linux3
/usr/bin/install -c -m 644 ./LICENSE /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/LICENSE.txt
PYTHONPATH=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7 LD_LIBRARY_PATH=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2: \
/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2/hostpython -Wi -tt /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/compileall.py \
-d /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7 -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7
Listing /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7 ...
Compiling /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/CGIHTTPServer.py ...
[...]
Compiling /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/xml/sax/expatreader.py ...
[...]
PYTHONPATH=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7 LD_LIBRARY_PATH=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2: \
/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2/hostpython -Wi -t /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/compileall.py \
-d /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/site-packages -f \
-x badsyntax /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/site-packages
make: [libinstall] Error 1 (ignored)
Listing /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/site-packages ...
Second install.
/usr/bin/install -c python /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin/python2.7
if test -f libpython2.7.so; then \
if test -n "" ; then \
/usr/bin/install -c -m 555 /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin; \
else \
/usr/bin/install -c -m 555 libpython2.7.so /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/libpython2.7.so; \
if test libpython2.7.so != libpython2.7.so; then \
(cd /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib; ln -sf libpython2.7.so libpython2.7.so) \
fi \
fi; \
else true; \
fi
# Substitution happens here, as the completely-expanded BINDIR
/usr/bin/install -c -m 644 ./Include/Python-ast.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
/usr/bin/install -c -m 644 ./Include/Python.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
# is not available in configure
/usr/bin/install -c -m 644 ./Include/abstract.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
[...]
running build
running build_ext
/usr/bin/install -c -m 644 ./Include/descrobject.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
/usr/bin/install -c -m 644 ./Include/dictobject.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
/usr/bin/install -c -m 644 ./Include/dtoa.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
[...]
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _curses _curses_panel
_sqlite3 _ssl _tkinter
bsddb185 bz2 dbm
dl gdbm imageop
linuxaudiodev nis ossaudiodev
readline spwd sunaudiodev
zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
running build_scripts
/usr/bin/install -c -m 644 ./Include/funcobject.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
/usr/bin/install -c -m 644 ./Include/genobject.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
/usr/bin/install -c -m 644 ./Include/intrcheck.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
CC='arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm' LDSHARED='arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -shared -lm' OPT='-DNDEBUG ' \
LD_LIBRARY_PATH=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2: /usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2/hostpython -E ./setup.py install \
--skip-build \
--prefix=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install \
--install-scripts=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin \
--install-platlib=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/lib-dynload \
--root=/
[...]
running install_scripts
copying build/scripts-2.7/2to3 -> /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin
/usr/bin/install -c -m 644 ./Include/stringobject.h /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/include/python2.7
copying build/scripts-2.7/idle -> /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin
/usr/bin/install -c -m 644 ./Lib/calendar.py /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7
changing mode of /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/bin/pydoc to 775
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/lib-dynload/Python-2.7.2-py2.7.egg-info
[...]
/usr/bin/install -c -m 644 ./LICENSE /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/LICENSE.txt
Compiling /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/BaseHTTPServer.py ...
Compiling /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/Bastion.py ...
[...]
Compiling /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/zipfile.py ...
PYTHONPATH=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7 LD_LIBRARY_PATH=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2: \
/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2/hostpython -Wi -t /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/compileall.py \
-d /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/site-packages -f \
-x badsyntax /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/site-packages
make: [libinstall] Error 1 (ignored)
Listing /usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7/site-packages ...
PYTHONPATH=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python-install/lib/python2.7 LD_LIBRARY_PATH=/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2: \
/usr/local/lib/python2.7/dist-packages/python-for-android/build/python/Python-2.7.2/hostpython -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
Leaving ARM environment
Call build_sdl
Entering in ARM environment
Compiler found at /home/kivy/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin//arm-linux-androideabi-gcc
find: `/usr/local/lib/python2.7/dist-packages/python-for-android/src/jni/../jni/application/src/': No such file or directory
Android NDK: WARNING:/usr/local/lib/python2.7/dist-packages/python-for-android/src/jni/../jni/application/Android.mk:application: non-system libraries in linker flags: -lpython2.7
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:/usr/local/lib/python2.7/dist-packages/python-for-android/src/jni/../jni/png/Android.mk:png: LOCAL_LDLIBS is always ignored for static libraries
rm -f /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/armeabi/lib*.so /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/armeabi-v7a/lib*.so /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/mips/lib*.so /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/x86/lib*.so
rm -f /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/armeabi/gdbserver /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/armeabi-v7a/gdbserver /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/mips/gdbserver /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/x86/gdbserver
rm -f /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/armeabi/gdb.setup /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/armeabi-v7a/gdb.setup /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/mips/gdb.setup /usr/local/lib/python2.7/dist-packages/python-for-android/src/libs/x86/gdb.setup
[armeabi] Compile thumb : sdl <= SDL_pixels.c
/home/kivy/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF /usr/local/lib/python2.7/dist-packages/python-for-android/src/obj/local/armeabi/objs/sdl/src/video/android/SDL_pixels.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/usr/local/lib/python2.7/dist-packages/python-for-android/src/jni/../jni/sdl -DANDROID -I/usr/local/lib/python2.7/dist-packages/python-for-android/src/jni/../jni/sdl/include -DSDL_JAVA_PACKAGE_PATH=org_renpy_android -DSDL_CURDIR_PATH=\"org.renpy.android\" -DSDL_TRACKBALL_KEYUP_DELAY=1 -DSDL_VIDEO_RENDER_RESIZE=0 -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCODE_0=SPACE -DSDL_ANDROID_KEYCODE_1=RETURN -DSDL_ANDROID_KEYCODE_2=LCTRL -DSDL_ANDROID_KEYCODE_3=LALT -DSDL_ANDROID_KEYCODE_4=RETURN -Wa,--noexecstack -Wformat -Werror=format-security -I/home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm/usr/include -c /usr/local/lib/python2.7/dist-packages/python-for-android/src/jni/../jni/sdl/src/video/android/SDL_pixels.c -o /usr/local/lib/python2.7/dist-packages/python-for-android/src/obj/local/armeabi/objs/sdl/src/video/android/SDL_pixels.o
/usr/local/lib/python2.7/dist-packages/python-for-android/src/jni/../jni/sdl/src/video/android/SDL_pixels.c:35:22: fatal error: SDL_blit.h: No such file or directory
compilation terminated.
make: *** [/usr/local/lib/python2.7/dist-packages/python-for-android/src/obj/local/armeabi/objs/sdl/src/video/android/SDL_pixels.o] Error 1
# Command failed: ./distribute.sh -m "kivy" -d "myapp"
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
I have installed the ndk and the sdk but seems to be unreachable by the command on compilation. I try to change and export the PATH to the NDK and the SDK but didn't work. May be I have a wrong config on the Android.mk or in other place.
I am try to use the default API level 14.

Related

Android- Qt - Protobuf: Compiling protobuf with ndk's prebuilt toolchains

I'm currently porting an application written in Qt5 to Android.
I have installed Qt5 through its official installer, along with the AndroidSdk through Android Studio.
I can compile, deploy and execute a Qt5/Qml application on an Android target.
However, the application I am porting uses Protobuf, therefore I want to cross-compile this library with the compiler Qt is using to package it with my application.
I have successfully built protobuf with a standalone toolchain following this resource : https://developers.google.com/cardboard/develop/c/protobuf
But when using the toolchain Qt5 uses I am not able to build the protobuf library.
A sample from my application's working compile commands:
/home/cfv/Android/Sdk/ndk/20.0.5594570/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -c -D__ANDROID_API__=21 -target armv7-none-linux-androideabi -gcc-toolchain /home/cfv/Android/Sdk/ndk/20.0.5594570/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -fno-limit-debug-info -DANDROID_HAS_WSTRING --sysroot=/home/cfv/Android/Sdk/ndk/20.0.5594570/sysroot -isystem /home/cfv/Android/Sdk/ndk/20.0.5594570/sysroot/usr/include/arm-linux-androideabi -isystem /home/cfv/Android/Sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include -isystem /home/cfv/Android/Sdk/ndk/20.0.5594570/sources/android/support/include -isystem /home/cfv/Android/Sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++abi/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -fPIC -Wl,Bsymbolic -g -g -marm -O0 -std=gnu++1z -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -I../NaioCompanion -I. -I/opt/Qt/5.13.0/android_armv7/include -I/opt/Qt/5.13.0/android_armv7/include/QtQuick -I/opt/Qt/5.13.0/android_armv7/include/QtGui -I/opt/Qt/5.13.0/android_armv7/include/QtQml -I/opt/Qt/5.13.0/android_armv7/include/QtNetwork -I/opt/Qt/5.13.0/android_armv7/include/QtConcurrent -I/opt/Qt/5.13.0/android_armv7/include/QtCore -I. -I/opt/Qt/5.13.0/android_armv7/mkspecs/android-clang -o xxx.o ../NaioCompanion/Publisher.cpp
The build script I uses for Protobuf, tweaked from the resource cited above:
export build_dir=`pwd`/../protobuf-for-android-with-qt5-toolchain/
export NDK=/home/cfv/Android/Sdk/ndk/20.0.5594570/
export sysroot=/home/cfv/Android/Sdk/ndk/20.0.5594570/platforms/android-21/arch-arm
export PATH=/home/cfv/Android/Sdk/ndk/20.0.5594570/toolchains/llvm/prebuilt/linux-x86_64/bin/:$PATH
export CC="/home/cfv/Android/Sdk/ndk/20.0.5594570/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --sysroot=$sysroot"
export CXX="/home/cfv/Android/Sdk/ndk/20.0.5594570/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --sysroot=$sysroot"
./configure \
--host=arm-linux-androideabi \
--with-protoc=protoc \
--with-sysroot="$sysroot" \
--disable-shared \
--prefix="$build_dir/armeabi-v7a" \
--enable-cross-compile \
CFLAGS="-D__ANDROID_API__=21 -target armv7-none-linux-androideabi -march=armv7-a" \
CXXFLAGS="-frtti -fexceptions -target armv7-none-linux-androideabi -D__ANDROID_API__=21" \
LIBS="-llog -lz"
make -j2
make install
the output:
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-androideabi-strip... arm-linux-androideabi-strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '1000' is supported by ustar format... yes
checking whether GID '1000' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking for arm-linux-androideabi-gcc... /home/cfv/Android/Sdk/ndk/20.0.5594570/toolchains /llvm/prebuilt/linux-x86_64/bin/clang --sysroot=/home/cfv/Android/Sdk/ndk/20.0.5594570/platforms/android-21/arch-arm
checking whether the C compiler works... no
configure: error: in `/home/cfv/projects/ext/try-to-build-protobuf/protobuf':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target 'install'. Stop.
And the config.log details:
configure:3866: checking whether the C compiler works
configure:3888: /home/cfv/Android/Sdk/ndk/20.0.5594570/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --sysroot=/home/cfv/Android/Sdk/ndk/20.0.5594570/platforms/android-21/arch-arm -D__ANDROID_API__=21 -target armv7-none-linux-androideabi -march=armv7-a -nostdlib++ -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -Wl,--exclude-libs,libunwind.a conftest.c -llog -lz >&5
clang: warning: argument unused during compilation: '-nostdlib++' [-Wunused-command-line-argument]
/home/cfv/Android/Sdk/ndk/20.0.5594570/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lunwind
/home/cfv/Android/Sdk/ndk/20.0.5594570/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lunwind
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3892: $? = 1
configure:3930: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "Protocol Buffers"
| #define PACKAGE_TARNAME "protobuf"
| #define PACKAGE_VERSION "3.6.0"
| #define PACKAGE_STRING "Protocol Buffers 3.6.0"
| #define PACKAGE_BUGREPORT "protobuf#googlegroups.com"
| #define PACKAGE_URL ""
| #define PACKAGE "protobuf"
| #define VERSION "3.6.0"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3935: error: in `/home/cfv/projects/ext/try-to-build-protobuf/protobuf':
configure:3937: error: C compiler cannot create executables
I think I am missing some compiler options (I especially am suspicious about -Wl,--exclude-libs,libunwind.a) but I have been struggling with it all day and this is way over my comfort zone.
Has anyone ever had a similar issue, and would be able to help me ?

Compile external module for Android

I am trying to compile a driver as a loadable module but whenever I adb shell into my phone and do an insmod test.ko I get the error message insmod: failed to load /data/local/tmp/test.ko: Exec format error. Grep'ing dmesg I find the following log: test: no symbol version for module_layout.
I've done quite a bit of googling [Ref] [Ref] [Ref] [Ref] [Ref] and reading the linux kbuild documentation txt files [Ref] [Ref] to no avail, so if someone knows the answer it'd be fab :) (I've only referenced the most helpful links I found).
What I've done so far is this:
I have an Qualcomm Aurora checkout and in the kernel directory I type the following
cp arch/arm64/configs/gemini_user_defconfig .config [B]# Has CONFIG_MODVERSIONS enabled and MODULE_SIG*=n[/B]
yes "" | make oldconfig ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- V=1
make prepare ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- V=1
make scripts ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- V=1
make modules ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- V=1
I have my PATH set to point to /MyAOSBDir/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin so I pick up the correct toolchain.
At this point appears to be well. In my kernel directory I have Module.symvers, so I appear to be set.
Now to the directory I have set up outside of this build tree with a dummy test... The Makefile looks like this:
KERNEL_DIR:=/solomon-build/MiNote2AOSB/kernel/
obj-m += test.o
PWD := $(shell pwd)
.PHONY: all
all:
$(MAKE) M=$(PWD) ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -C $(KERNEL_DIR) modules V=1
clean:
$(MAKE) M=$(PWD) -C $(KERNEL_DIR) clean
The driver is just a dummy:
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/init.h> /* Needed for the macros */
static int __init hello_start(void)
{
printk(KERN_INFO "Hello world\n");
return 0;
}
static void __exit hello_end(void)
{
printk(KERN_INFO "Goodbye world\n");
}
module_init(hello_start);
module_exit(hello_end);
I do make make all at the comment line and get this output:
make M=/solomon-build/build_mxt_kmod ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -C /solomon-build/MiNote2AOSB/kernel/ modules V=1
make[1]: Entering directory `/solomon-build/MiNote2AOSB/kernel'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
mkdir -p /solomon-build/build_mxt_kmod/.tmp_versions ; rm -f /solomon-build/build_mxt_kmod/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/solomon-build/build_mxt_kmod
./scripts/gcc-wrapper.py aarch64-linux-android-gcc -Wp,-MD,/solomon-build/build_mxt_kmod/.test.o.d -nostdinc -isystem /solomon-build/MiNote2AOSB/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/../lib/gcc/aarch64-linux-android/4.9.x-google/include -I./arch/arm64/include -Iarch/arm64/include/generated -Iinclude -I./arch/arm64/include/uapi -Iarch/arm64/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -mgeneral-regs-only -fno-pic -fno-delete-null-pointer-checks -Os -Wno-maybe-uninitialized --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(test)" -D"KBUILD_MODNAME=KBUILD_STR(test)" -c -o /solomon-build/build_mxt_kmod/.tmp_test.o /solomon-build/build_mxt_kmod/test.c
(cat /dev/null; echo kernel//solomon-build/build_mxt_kmod/test.ko;) > /solomon-build/build_mxt_kmod/modules.order
make -f ./scripts/Makefile.modpost
find /solomon-build/build_mxt_kmod/.tmp_versions -name '*.mod' | xargs -r grep -h '\.ko$' | sort -u | sed 's/\.ko$/.o/' | scripts/mod/modpost -m -i ./Module.symvers -I /solomon-build/build_mxt_kmod/Module.symvers -o /solomon-build/build_mxt_kmod/Module.symvers -S -E -w -s -T -
./scripts/gcc-wrapper.py aarch64-linux-android-gcc -Wp,-MD,/solomon-build/build_mxt_kmod/.test.mod.o.d -nostdinc -isystem /solomon-build/MiNote2AOSB/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/../lib/gcc/aarch64-linux-android/4.9.x-google/include -I./arch/arm64/include -Iarch/arm64/include/generated -Iinclude -I./arch/arm64/include/uapi -Iarch/arm64/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -mgeneral-regs-only -fno-pic -fno-delete-null-pointer-checks -Os -Wno-maybe-uninitialized --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(test.mod)" -D"KBUILD_MODNAME=KBUILD_STR(test)" -DMODULE -c -o /solomon-build/build_mxt_kmod/test.mod.o /solomon-build/build_mxt_kmod/test.mod.c
aarch64-linux-android-ld -EL -r -T ./scripts/module-common.lds --build-id --fix-cortex-a53-843419 -o /solomon-build/build_mxt_kmod/test.ko /solomon-build/build_mxt_kmod/test.o /solomon-build/build_mxt_kmod/test.mod.o
make[1]: Leaving directory `/solomon-build/MiNote2AOSB/kernel'
So, there are no messages saying there is a missing Module.symvers, so that's good, and I do get a built .ko file.
What I don't understand is the message ERROR: Kernel configuration is invalid. The files it is talking about exist, so I know they have been created in my kernel build.
Anyway, trying to insmod this onto the phone gives the message I mentioned previously. If I cat Module.symvers I see:
0xff924338 backlight_force_update drivers/video/backlight/backlight EXPORT_SYMBOL
0x30254daf test_iosched_register block/test-iosched EXPORT_SYMBOL
<snip>
0xdd502540 backlight_device_unregister drivers/video/backlight/backlight EXPORT_SYMBOL
0x9939eba0 backlight_unregister_notifier drivers/video/backlight/backlight EXPORT_SYMBOL
So no symbol module_layout in the file, and thus no CRC, which is what I presume is creating the error message?
Any clues would be much appreciated, thank you.
Oh I should also mention that the module and kernel vermagic match:
# modinfo /data/local/tmp/test.ko
filename: /data/local/tmp/test.ko
depends:
vermagic: 3.18.20-mytestkernel-perf-g671c431-dirty SMP preempt mod_unload modversions aarch64
# uname -a
Linux localhost 3.18.20-mytestkernel-perf-g671c431-dirty #1 SMP PREEMPT Mon Jun 5 15:46:13 BST 2017 aarch64
*EDIT - FOUND SOLUTION - NEW QUESTON *:
I've gotten much further since posting. What I realised was, was that the compilation of the kernel using the Android build system is producing a radically different Module.symvers one from my method above (for some reason it took a while for the penny to drop and for me to check the Andoird build output - duh!). In fact, I've realised I always had the Module.symvers file, it was just located in ../out/target/product/msm8996/obj/KERNEL_OBJ/Module.symvers relative to the kernel dir. Copying this file into kernel and re-running my module build now produces a module that loads correctly :)
So, I guess the question becomes, why do the two files differ? What is Android doing differently? I assume it is setting up some more detailed config, but how/what/why?
So, the answer was relatively simple in the end...
I just use the normal Android build process of sourcing envsetup.sh, running lunch and then building the kernel:
. build/envsetup.sh
lunch msm8996-userdebug
make kernel -j16
(Remember to make sure in your .config file to set CONFIG_MODULES=y and set any kernel drivers to =m if you want them as modules).
In the separate directory, not in the Android build tree I now have my new module and the following Makefile, which now looks like this:
MY_ANDROID_ROOT_DIR :=/path/to/my/android/checkout
KERNEL_DIR:=$(MY_ANDROID_ROOT_DIR)/kernel
obj-m += my_driver.o
PWD := $(shell pwd)
.PHONY: all
all:
$(MAKE) \
M=$(PWD) \
ARCH=arm64 \
CROSS_COMPILE=aarch64-linux-android- \
-C $(KERNEL_DIR) \
modules \
V=1 \
O=$(MY_ANDROID_ROOT_DIR)/out/target/product/msm8996/obj/KERNEL_OBJ
clean:
$(MAKE) M=$(PWD) -C $(KERNEL_DIR) clean
The make all output will still be in your modules directory (not the Android output dir).
This is basically identical to all of the examples relating to pure Linux builds. The only extra bit of information I needed to provide was where the Android build system output its build files, which is O=$(MY_ANDROID_ROOT_DIR)/out/target/product/<your-product>/obj/KERNEL_OBJ.
The O= define tells Make where to find the output of the kernel build.
The 'V=1` define tells Make to output verbose build information.
modules is a kernel target that will build you module defined in the Makefile variable obj-m. This variable "specifies the object files which are built as loadable kernel modules".
Now my modules build fine and I don't need to worry about independently compiling the kernel or anything like that to fix missing file messages (although it will still output about autoconf.h, which I don't understand because it exists in my tree and doesn't seem to stop my modules working).
PS If you module includes more than one file define obj-m += my_driver.o and then my_driver-m:= <extra objects>.

Using buildozer with Kivy 1.9.1-dev

I want to contribute to Kivy 1.9.1-dev.
Trying to debug on android, using buildozer, from ~/ I've tried:
git clone git://github.com/kivy/kivy.git
cd kivy
python setup.py build_ext --inplace -f
then from ~/ I did:
git clone https://github.com/kivy/buildozer.git
cd buildozer
sudo python2.7 setup.py install
finally from ~/kivy-test/
buildozer init
buildozer android debug deploy run
eventually I get the following error:
Detected compiler is unix
building 'kivy.graphics.vertex_instructions' extension
ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/navatm/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -DNDEBUG -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/navatm/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -fPIC -I/home/navatm/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm/usr/include -I/home/navatm/code/kivy-test/.buildozer/android/platform/python-for-android/build/python-install/include/python2.7 -c kivy/graphics/vertex_instructions.c -o build/temp.linux-x86_64-2.7/kivy/graphics/vertex_instructions.o
kivy/graphics/vertex_instructions.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^
error: command 'ccache' failed with exit status 1
# Command failed: ./distribute.sh -m "kivy" -d "myapp"
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
Any suggestions?

Making apk with Kivy and Buildozer on Ubuntu 12.04

I'm not able to make APK of my simple kivy module with buildozer.
Following is the error dump:
Entering in ARM enviromnent
Compiler found at /home/roshan/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin//arm-linux-androideabi-gcc
/home/roshan/AndroidApp/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running build_ext
building 'jnius' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/roshan/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -DNDEBUG -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/roshan/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -fPIC -I/home/roshan/AndroidApp/.buildozer/android/platform/python-for-android/build/python-install/include/python2.7 -c jnius/jnius.c -o build/temp.linux-i686-2.7/jnius/jnius.o
jnius/jnius.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^
error: command 'arm-linux-androideabi-gcc' failed with exit status 1
Compiling /home/roshan/AndroidApp/.buildozer/android/platform/python-for-android/build/pyjnius/pyjnius-master/jnius/jnius.pyx
Error compiling Cython file:
------------------------------------------------------------
...
cdef class ByteArray:
cdef LocalRef _jobject
cdef long _size
cdef jbyte *_buf
cdef jbyte[:] _arr
^
------------------------------------------------------------
jnius/jnius_nativetypes.pxi:19:15: Expected an identifier or literal
/home/roshan/AndroidApp/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running build_ext
building 'jnius' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/roshan/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -DNDEBUG -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/roshan/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -fPIC -I/home/roshan/AndroidApp/.buildozer/android/platform/python-for-android/build/python-install/include/python2.7 -c jnius/jnius.c -o build/temp.linux-i686-2.7/jnius/jnius.o
jnius/jnius.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^
error: command 'arm-linux-androideabi-gcc' failed with exit status 1
# Command failed: ./distribute.sh -m "kivy" -d "Playstring"
How to resolve it. I tried installing cython again but it did not helped.
It looks like your Cython is too old. I had similar issues when I started Kivy development on 12.04. Try installing a newer version from PPA or using PIP.
From PPA:
sudo apt-add-repository ppa:cython-dev/master-ppa
sudo apt-get update
sudo apt-get install cython
Using PIP:
sudo apt-get install python-pip
sudo pip install --upgrade cython

Compile command-line C application with Android NDK

I am trying to compile Frotz to run in a terminal emulator so it will execute on my Android Ice Cream Sandwich smartphone. Frotz is an open source Z-Machine interpreter for playing interactive fiction and is basically just a command-line application. I have done the following:
Downloaded Android NDK (android-ndk-r8d) and extracted it on my Windows 7 laptop. (Extracted to c:\android\android-ndk-r8d)
Downloaded and installed Cygwin, including all development packages. (So make is installed)
Using Cygwin, navigate to the folder containing the extracted Frotz makefile and source folder and try to execute make.
When I try run make, I encounter issues relating to curses.h not being found (but this issue is not the focus of this question; maybe a point for a followup question). When I do make dumb (which compiles a simplified version of Frotz), the compile succeeds and I am able to run it within Cygwin. But if I copy the compiled command-line application to the phone and try execute it, I get the following error:
not executable: magic 4D5A
I suspect the problem here is that the executable is now not compiled for the Arm architecture. The make file has the following line in it:
CC = gcc
which I have tried changing to:
CC = /cygdrive/c/android/android-ndk-r8d/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-gcc.exe
But now when I execute make, I get the following error message:
fatal error: signal.h: No such file or directory
I am very new to C development (and Android) and struggling to figure out how to change the makefile so that it will compile correctly for Android. I will include the complete makefile below and will appreciate whatever help anyone can offer in getting this to correctly compile for Android.
The complete Frotz makefile:
# Define your C compiler. I recommend gcc if you have it.
# MacOS users should use "cc" even though it's really "gcc".
#
CC = gcc
#CC = cc
# Define your optimization flags. Most compilers understand -O and -O2,
# Standard (note: Solaris on UltraSparc using gcc 2.8.x might not like this.)
#
OPTS = -O2
# Pentium with gcc 2.7.0 or better
#OPTS = -O2 -fomit-frame-pointer -malign-functions=2 -malign-loops=2 \
#-malign-jumps=2
# Define where you want Frotz installed. Usually this is /usr/local
PREFIX = /usr/local
MAN_PREFIX = $(PREFIX)
#MAN_PREFIX = /usr/local/share
CONFIG_DIR = $(PREFIX)/etc
#CONFIG_DIR = /etc
# Define where you want Frotz to look for frotz.conf.
#
CONFIG_DIR = /usr/local/etc
#CONFIG_DIR = /etc
#CONFIG_DIR = /usr/pkg/etc
#CONFIG_DIR =
# Uncomment this if you want color support. Most, but not all curses
# libraries that work with Frotz will support color.
#
COLOR_DEFS = -DCOLOR_SUPPORT
# Uncomment this if you have an OSS soundcard driver and want classical
# Infocom sound support.
#
#SOUND_DEFS = -DOSS_SOUND
# Uncomment this too if you're running BSD of some sort and are using
# the OSS sound driver.
#
#SOUND_LIB = -lossaudio
# Define your sound device
# This should probably be a command-line/config-file option.
#
#SOUND_DEV = /dev/dsp
#SOUND_DEV = /dev/sound
#SOUND_DEV = /dev/audio
# If your vendor-supplied curses library won't work, uncomment the
# location where ncurses.h is.
#
#INCL = -I/usr/local/include
#INCL = -I/usr/pkg/include
#INCL = -I/usr/freeware/include
#INCL = -I/5usr/include
#INCL = -I/path/to/ncurses.h
# If your vendor-supplied curses library won't work, uncomment the
# location where the ncurses library is.
#
#LIB = -L/usr/local/lib
#LIB = -L/usr/pkg/lib
#LIB = -L/usr/freeware/lib
#LIB = -L/5usr/lib
#LIB = -L/path/to/libncurses.so
# One of these must always be uncommented. If your vendor-supplied
# curses library won't work, comment out the first option and uncomment
# the second.
#
CURSES = -lcurses
#CURSES = -lncurses
# Uncomment this if your need to use ncurses instead of the
# vendor-supplied curses library. This just tells the compile process
# which header to include, so don't worry if ncurses is all you have
# (like on Linux). You'll be fine.
#
#CURSES_DEF = -DUSE_NCURSES_H
# Uncomment this if you're compiling Unix Frotz on a machine that lacks
# the memmove(3) system call. If you don't know what this means, leave it
# alone.
#
#MEMMOVE_DEF = -DNO_MEMMOVE
# Uncomment this if for some wacky reason you want to compile Unix Frotz
# under Cygwin under Windoze. This sort of thing is not reccomended.
#
#EXTENSION = .exe
#####################################################
# Nothing under this line should need to be changed.
#####################################################
SRCDIR = src
VERSION = 2.43d
NAME = frotz
BINNAME = $(NAME)
DISTFILES = bugtest
DISTNAME = $(BINNAME)-$(VERSION)
distdir = $(DISTNAME)
COMMON_DIR = $(SRCDIR)/common
COMMON_TARGET = $(SRCDIR)/frotz_common.a
COMMON_OBJECT = $(COMMON_DIR)/buffer.o \
$(COMMON_DIR)/err.o \
$(COMMON_DIR)/fastmem.o \
$(COMMON_DIR)/files.o \
$(COMMON_DIR)/hotkey.o \
$(COMMON_DIR)/input.o \
$(COMMON_DIR)/main.o \
$(COMMON_DIR)/math.o \
$(COMMON_DIR)/object.o \
$(COMMON_DIR)/process.o \
$(COMMON_DIR)/quetzal.o \
$(COMMON_DIR)/random.o \
$(COMMON_DIR)/redirect.o \
$(COMMON_DIR)/screen.o \
$(COMMON_DIR)/sound.o \
$(COMMON_DIR)/stream.o \
$(COMMON_DIR)/table.o \
$(COMMON_DIR)/text.o \
$(COMMON_DIR)/variable.o
CURSES_DIR = $(SRCDIR)/curses
CURSES_TARGET = $(SRCDIR)/frotz_curses.a
CURSES_OBJECT = $(CURSES_DIR)/ux_init.o \
$(CURSES_DIR)/ux_input.o \
$(CURSES_DIR)/ux_pic.o \
$(CURSES_DIR)/ux_screen.o \
$(CURSES_DIR)/ux_text.o \
$(CURSES_DIR)/ux_audio_none.o \
$(CURSES_DIR)/ux_audio_oss.o
DUMB_DIR = $(SRCDIR)/dumb
DUMB_TARGET = $(SRCDIR)/frotz_dumb.a
DUMB_OBJECT = $(DUMB_DIR)/dumb_init.o \
$(DUMB_DIR)/dumb_input.o \
$(DUMB_DIR)/dumb_output.o \
$(DUMB_DIR)/dumb_pic.o
TARGETS = $(COMMON_TARGET) $(CURSES_TARGET)
OPT_DEFS = -DCONFIG_DIR="\"$(CONFIG_DIR)\"" $(CURSES_DEF) \
-DVERSION="\"$(VERSION)\"" -DSOUND_DEV="\"$(SOUND_DEV)\""
COMP_DEFS = $(OPT_DEFS) $(COLOR_DEFS) $(SOUND_DEFS) $(SOUNDCARD) \
$(MEMMOVE_DEF)
FLAGS = $(OPTS) $(COMP_DEFS) $(INCL)
$(NAME): $(NAME)-curses
$(NAME)-curses: soundcard.h $(COMMON_TARGET) $(CURSES_TARGET)
$(CC) -o $(BINNAME)$(EXTENSION) $(TARGETS) $(LIB) $(CURSES) \
$(SOUND_LIB)
all: $(NAME) d$(NAME)
dumb: $(NAME)-dumb
d$(NAME): $(NAME)-dumb
$(NAME)-dumb: $(COMMON_TARGET) $(DUMB_TARGET)
$(CC) -o d$(BINNAME)$(EXTENSION) $(COMMON_TARGET) \
$(DUMB_TARGET) $(LIB)
.SUFFIXES:
.SUFFIXES: .c .o .h
.c.o:
$(CC) $(FLAGS) $(CFLAGS) -o $# -c $<
# If you're going to make this target manually, you'd better know which
# config target to make first.
#
common_lib: $(COMMON_TARGET)
$(COMMON_TARGET): $(COMMON_OBJECT)
#echo
#echo "Archiving common code..."
ar rc $(COMMON_TARGET) $(COMMON_OBJECT)
ranlib $(COMMON_TARGET)
#echo
curses_lib: config_curses $(CURSES_TARGET)
$(CURSES_TARGET): $(CURSES_OBJECT)
#echo
#echo "Archiving curses interface code..."
ar rc $(CURSES_TARGET) $(CURSES_OBJECT)
ranlib $(CURSES_TARGET)
#echo
dumb_lib: $(DUMB_TARGET)
$(DUMB_TARGET): $(DUMB_OBJECT)
#echo
#echo "Archiving dumb interface code..."
ar rc $(DUMB_TARGET) $(DUMB_OBJECT)
ranlib $(DUMB_TARGET)
#echo
soundcard.h:
#if [ ! -f $(SRCDIR)/soundcard.h ] ; then \
sh $(SRCDIR)/misc/findsound.sh $(SRCDIR); \
fi
install: $(NAME)
strip $(BINNAME)$(EXTENSION)
install -d $(PREFIX)/bin
install -d $(MAN_PREFIX)/man/man6
install -c -m 755 $(BINNAME)$(EXTENSION) $(PREFIX)/bin
install -c -m 644 doc/$(NAME).6 $(MAN_PREFIX)/man/man6
uninstall:
rm -f $(PREFIX)/bin/$(NAME)
rm -f $(MAN_PREFIX)/man/man6/$(NAME).6
deinstall: uninstall
install_dumb: d$(NAME)
strip d$(BINNAME)$(EXTENSION)
install -d $(PREFIX)/bin
install -d $(MAN_PREFIX)/man/man6
install -c -m 755 d$(BINNAME)$(EXTENSION) $(PREFIX)/bin
install -c -m 644 doc/d$(NAME).6 $(MAN_PREFIX)/man/man6
uninstall_dumb:
rm -f $(PREFIX)/bin/d$(NAME)
rm -f $(MAN_PREFIX)/man/man6/d$(NAME).6
deinstall_dumb: uninstall_dumb
distro: dist
dist: distclean
mkdir $(distdir)
#for file in `ls`; do \
if test $$file != $(distdir); then \
cp -Rp $$file $(distdir)/$$file; \
fi; \
done
find $(distdir) -type l -exec rm -f {} \;
tar chof $(distdir).tar $(distdir)
gzip -f --best $(distdir).tar
rm -rf $(distdir)
#echo
#echo "$(distdir).tar.gz created"
#echo
clean:
rm -f $(SRCDIR)/*.h $(SRCDIR)/*.a
rm -f $(COMMON_DIR)/*.o $(CURSES_DIR)/*.o $(DUMB_DIR)/*.o
distclean: clean
rm -f $(BINNAME)$(EXTENSION) d$(BINNAME)$(EXTENSION)
rm -f $(BINNAME).exe $(BINNAME).bak $(BINNAME).lib
rm -f *core $(SRCDIR)/*core
-rm -rf $(distdir)
-rm -f $(distdir).tar $(distdir).tar.gz
realclean: distclean
clobber: distclean
help:
#echo
#echo "Targets:"
#echo " frotz"
#echo " dfrotz"
#echo " install"
#echo " uninstall"
#echo " clean"
#echo " distclean"
#echo
With android-ndk-r8d, you don't need cygwin: make can be found in c:\android\android-ndk-r8d\prebuilt\windows32\bin.
Anyways, to use a makefile, you should follow the instructions in c:\android\android-ndk-r8d\STANDALONE-TOOLCHAIN.html

Categories

Resources