0

I have two options to compile, Option1: Cross-compile using a x86_x64 ubuntu or debian system for armhf package compilation, Option2 Image of ubuntu or debian armhf in Qemu.

The problem I have is that when using cross compilation, the compilation fails because the source packages have been compiled using gcc4.8 and the version that i have installed for cross compilation is gcc4.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 python2 and python3 installed, I have root access on my tablet, I can run commands like

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

I can also run python files 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, in 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" and when I use the command "command -v zip" the file exist, it is correctly installed and the permissions are correct, Minimally I should 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

Gives me armv7l

Any solution?

10

1 Answer 1

0

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.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/system/lib

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!

0

You must log in to answer this question.

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