Buildozer with numpy

292 views
Skip to first unread message

Michael Currie

unread,
Apr 5, 2018, 5:54:07 AM4/5/18
to Kivy users support
Hello,

I am trying to use buildozer to create an Android APK for a program with numpy and scipy as dependencies.

However, when going through the steps from a clean Ubuntu machine to installing all the dependencies, somehow it's now broken on installing numpy and gives this error:

RuntimeError: Broken toolchain: cannot link a simple C programimage

Here are the exact steps I followed:

# Run these steps from a clean Ubuntu machine provisioned from AWS EC2

sudo -H apt-get update
sudo -H apt-get -y install python-pip
sudo -H pip install --upgrade pip

sudo -H apt-get -y install default-jdk
sudo -H apt-get -y install unzip
# cython will fail if you don't install this:
# (see http://stackoverflow.com/questions/11094718/)
sudo -H apt-get -y install python-dev

# Because 0.22 the latest version is no good because of kivy/buildozer#150
# https://github.com/kivy/buildozer/issues/150
sudo -H pip install cython==0.21
sudo -H pip install numpy
sudo -H apt-get install -Y mesa-common-dev

# Install all the dependencies listed under "Ubuntu example" 
# http://kivy.org/docs/installation/installation-linux.html#ubuntu-kubuntu-xubuntu-lubuntu-saucy-and-above 
# EXCEPT use libav-tools instead of ffmpeg as per 
# http://askubuntu.com/questions/432542/is-ffmpeg-missing-from-the-official-repositories-in-14-04
# The library libatlas-base-dev is so that numpy will work in Android, according to
# http://stackoverflow.com/questions/29742289/error-packaging-kivy-with-numpy-library-for-android-using-buildozer
# although it did not work
sudo apt-get install -y build-essential
sudo apt-get install -y git
sudo apt-get install -y python
sudo apt-get install -y python-dev
sudo apt-get install -y libav-tools
sudo apt-get install -y libsdl2-2.0-0
sudo apt-get install -y libsdl2-image-2.0-0
sudo apt-get install -y libsdl2-mixer-2.0-0
sudo apt-get install -y libsdl2-ttf-2.0-0
sudo apt-get install -y libsdl2-dev
sudo apt-get install -y libsdl2-image-dev
sudo apt-get install -y libsdl2-mixer-dev
sudo apt-get install -y libsdl2-ttf-dev
sudo apt-get install -y libportmidi-dev
sudo apt-get install -y libswscale-dev
sudo apt-get install -y libavformat-dev
sudo apt-get install -y libavcodec-dev
sudo apt-get install -y zlib1g-dev
sudo apt-get install -y libatlas-base-dev

sudo -H pip install kivy


# To correct an error running buildozer:
#/home/oleg/.buildozer/android/platform/android-sdk-21/tools/ant/build.xml:655: 
# Execute failed: java.io.IOException: 
# Cannot run program "/home/oleg/.buildozer/android/platform/android-sdk-21/build-tools/19.1.0/aidl": 
# error=2, No such file or directory
# From http://stackoverflow.com/questions/31416122/i-cant-build-buildozer-for-android
# resolution :

sudo -H apt-get install -y python-pip
sudo pip install --upgrade buildozer
sudo -H apt-get install -y python2.7-dev
sudo dpkg --add-architecture i386
sudo -H apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y ccache
sudo apt-get install -y lib32z1
sudo apt-get install -y libncurses5:i386
sudo apt-get install -y libstdc++6:i386
sudo apt-get install -y python2.7
sudo apt-get install -y openjdk-7-jdk
sudo apt-get install -y unzip
sudo apt-get install -y zlib1g-dev
sudo apt-get install -y zlib1g:i386

sudo -H apt-get install -y python-kivy

# BUILDOZER
# From http://buildozer.readthedocs.org/en/latest/installation.html
sudo -H pip install --upgrade buildozer

# Pull down repository from GitHub
cd ~
mkdir alterx
# -L is to follow redirects.  -H is to provide the header, which GitHub requires since this is a private repo
curl -L -H 'Authorization: token '$GITHUB_OAUTH_TOKEN'' -o 1.10.2.tar.gz https://github.com/romanodev/alterx/archive/1.10.2.tar.gz
tar -xvzf 1.10.2.tar.gz
mv alterx-1.10.2/ alterx/
cd alterx/
mv alterx-1.10.2/* .
mv alterx-1.10.2/.* .
rm -rf alterx-1.10.2/
cd ~
rm 1.10.2.tar.gz

# RUN BUILDOZER
cd ~/alterx/android_deployment
# Make our makefile executable
chmod +x make.sh

# Don't run this as root
#buildozer init

# Run buildozer once to download all dependencies
#buildozer --verbose android debug
By the way, if someone could make a dockerfile that describes exactly what is needed to have a valid Buildozer machine that would be great. these steps almost work for me, and have in the past, but now do not.
Reply all
Reply to author
Forward
0 new messages