I have two options to compile:

  • Cross-compile using an amd64 Ubuntu or Debian system for armhf package compilation.
  • Run an armhf image of Ubuntu or Debian in QEMU.

The problem I have is that when using cross compilation, the compilation fails because the source packages have been compiled using GCC 4.8 and the version that I have installed for cross compilation is GCC 4.9.

For this reason I opted to build directly from a Ubuntu or Debian armhf image in QEMU.

Now, the final problem and the reason why I am asking the question here is the following:

I have seen and tested that some people has been build Python, modules and executable binaries for Android, I currently have Python 2 and Python 3 installed, I have root access on my tablet, I can run commands like

python -c 'print("hello world!")'

I can also run Python scripts just fine like

python myscript.py

They used the following flags to compile python:

./configure --build=arm --prefix="$PWD"/out LDFLAGS="-static -static-libgcc -Wl,--unresolved-symbols=ignore-all -Wl,--export-dynamic" CPPFLAGS=-static CXXFLAGS=-static CFLAGS="-Os -static" LDFLAGS=-static LD=ld.gold

Unfortunately I have not been successful, I tried to compile the Debian zip package with the following commands and it did not work.

apt-get build-dep zip
apt-get source zip
cd zip-3.0
export CFLAGS=-static
export LDFLAGS=-static
export CPPFLAGS=-static
dpkg-buildpackage -rfakeroot -uc -b

After compiling the package, a .deb package is generated, from which I extract all the binaries and executables to later install them manually on my tablet, preserving the directories correctly, granting the appropriate permissions using chmod and chown and creating the symbolic links so that they have a connection with their corresponding libraries, since Android uses a slightly different directory structure.

But it doesn't work. Everything is compiled and the package is generated, then when I do the installation process mentioned above, I restart the tablet and run the command in this case zip to see if it is already working, the result is no, since I get an error saying "No such file or directory".

Running command -v zip shows that the file exist, it is correctly installed and the permissions are correct. I should at least get an error, for example "error: somelib .so not found" if it had at least been compiled correctly, since some dependencies has not been compiled yet, but not.

uname -m

outputs me armv7l.

Any solution?

1 Answer 1


Thinking and Thinking i've found the solution, I post as my own answer, because it can help somebody, more if somebody are building in a EOL Enviroment, as described in the comments, the problem is in the LD_LIBRARY_PATH, you have to export the /system/lib path as a LD_LIBRARY_PATH, to make ld-linux-armhf.so.* accesible to the executable, because is the interpreter.


Is not only necessary made the symlinks, you have to export all environment variables, to preserve the correct linux ubuntu structure.

Also, you can mount the libraries /system/lib in the root path /lib, is more easy and complete, here the command:

su root
mkdir -p /lib
chmod 0755 /lib
mount --bind /system/lib /lib

All of that have to be maded in the target device, in this case the Tablet.

This will create a perfect mix of android os and ubuntu os, or debian os if you are building in debian enviroment in the sense of the routes, after it you have to solve the missing paths if you forget some. Good Luck!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .