I'm trying, on Debian 9.4 x64, to compiling static Python 3.6.5 binary for Android (so arm32, arm64, ...).

I'm not sure of which library using to build Python 3.6.5 for arm and mips processors, for now i use "binutils-gold-2.29.1-16.1.armv7hl.rpm", but if another rpm is better for this usage please tel me wich one take.

  • I tried to compile the binary with this following command:
    • ./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
  • EDIT: And by typing this one: make clean; make install
  • And i get this error:
    • FIG_H -DUSE_PYEXPAT_CAPI -c ./Modules/expat/xmlparse.c -o Modules/xmlparse.o
    • ./Modules/expat/xmlparse.c:92:3: error: #error You do not have support for any sources of high quality entropy enabled.
    • error \
    • .Makefile:1874 : the recipe for the target « Modules/xmlparse.o » as failed
    • make: *** [Modules/xmlparse.o] Erreur 1

I'm trying to find how i could fix this error, but unfortunatly the support webpage on Python website isn't very helpfull (https://wiki.python.org/moin/BuildStatically).

Finally, I would like to compile Python 3.6.5 for all processor platforms on which Android can run (arm32, aarm64, x86_x64, mips, mipsx64,...), to finally get a one single binary file (i will repeat tasks for all other archs when i will have done with arm32).

So one file for each architectures cited, not multiple files/folders in output. In a static way to avoid any dependencies with external libraries. I chose to carry out the build operations, but if other less hazardous and simpler solutions exist i am taker.

NB: all cmd line has been made through LXTerminal on root session by default.

Thanks by advance for help.

  • I'm guessing you might be missing some include files for the arm architecture. Googling for the filename gave me this file we find that an error occurs if we don't have one of a bunch of C macro defines. Searching the source code for one of these we find this is set by configure (I think) after trying to execute a c code chunk. – Att Righ May 22 '18 at 21:03
  • Thanks for having reply, i just have check in "/python3.6.5/Modules/expat/" and i already have the "xmlparse.c" file, maybe i could take the one from the official git on the corresponding branch and replacing the file on my debian by the new one ? Although i only roughly understand what the error message (a problem with this file) means, i don't see what action i need to take. – Rom May 22 '18 at 21:23
  • Why are you using a binutils RPM on Debian? – Stephen Kitt May 22 '18 at 21:28
  • @StephenKitt I use binutils RPM on my Debian because initially, i was following this tutorial (forum.xda-developers.com/…), which mentions this file, so I installed it, maybe i shouldn't have to? – Rom May 22 '18 at 21:32
  • i already have the I meant to say that you are missing library header files for the arm architecture (random.h) See this line of the configuration [github.com/python/cpython/blob/… you want to get this C sample to compile through your cross compiler (I think). – Att Righ May 22 '18 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.