Page 1 of 1

Problems compiling for x86 Android on Linux

Posted: Sun Mar 13, 2016 12:32 pm
by styx
Hello!

I got myself a small Android Tablet and out of curiosity I tried to compile Texel and Stockfish Dev Engines for it to use in Droidfish or "Chess for Android" (I know that both engines are available in the Google Play Store). It does not have the common ARM5/7 Processor, but an Intel Atom Z3735F with x86 architecture.

I read on Aart Bik's page, that every x86-32 Linux compile should work on that kind of devices:

http://www.aartbik.com/MISC/eng.html

But it doesn't. Theres a very cryptic error message when I try to load it into Droidfish. Anyone have an idea what the problem might be?

I used my Ubuntu 15.10 Linux PC with gcc 5.2.1-12 for compiling.
I tried several different 32-bit ARCH compiles for Stockfish. The work flawlessly on my PC but not on my tablet.

Thanks in advance!

Re: Problems compiling for x86 Android on Linux

Posted: Sun Mar 13, 2016 6:12 pm
by stegemma
Maybe you need to run "chmod +x engine.exe"?

Re: Problems compiling for x86 Android on Linux

Posted: Sun Mar 13, 2016 6:18 pm
by mar
styx wrote:Hello!

I got myself a small Android Tablet and out of curiosity I tried to compile Texel and Stockfish Dev Engines for it to use in Droidfish or "Chess for Android" (I know that both engines are available in the Google Play Store). It does not have the common ARM5/7 Processor, but an Intel Atom Z3735F with x86 architecture.
I have a Chuwi tablet with dual boot (Android and Windows), and I didn't have to do anything special to run my ARM engine on it - it actually emulates ARM.
While this may not run as fast as native ARM, it actually runs pretty well - so it must use JIT.
That being said, I'm not sure if your tablet also emulates ARM or if it runs native x86 Android; if it's the latter then this probably won't help you.

Re: Problems compiling for x86 Android on Linux

Posted: Sun Mar 13, 2016 7:10 pm
by styx
stegemma wrote:Maybe you need to run "chmod +x engine.exe"?
I cannot set the execution flag since I don't have a rooted device. But I doubt that it's necessary. On my ARM7 Android phone I don't need to set that flag either.
mar wrote:I have a Chuwi tablet with dual boot (Android and Windows), and I didn't have to do anything special to run my ARM engine on it - it actually emulates ARM.
While this may not run as fast as native ARM, it actually runs pretty well - so it must use JIT.
That being said, I'm not sure if your tablet also emulates ARM or if it runs native x86 Android; if it's the latter then this probably won't help you.
Now it gets a bit confusing. I tried the official download (SF6 at stockfishchess.com) and it worked - but very very slow. Then I tried the ARM 7 compiles from Jim Ablett and it doesn't work (Cannot open the Engine).

I guess this is not the final answer. I'm not sure what exactly my tablet expects. Weird stuff!

Re: Problems compiling for x86 Android on Linux

Posted: Mon Mar 14, 2016 10:09 am
by Gurcan Uckardes
I suggest you contact with Aart. He managed to compile for x86 Android with several engines.
I never tried Android compiles. Having tested many engines so far, i can confirm Jim's compiles won't run with x86. Some builds do but the emulation costs 1.5 to 3 times lower than arm speed.
No matter what, if you want to compile an x86 build, it's different than Windows. You need all required Android libraries ready and you must compile for Android with x86 target.
For details, see with Aart. Jim can't help you on this.

Re: Problems compiling for x86 Android on Linux

Posted: Sat Mar 26, 2016 8:43 pm
by abik
Happy to give some pointers.

Did you install my chess engines package (which contain both arm and x86 binaries) and do those binaries run fine on your Intel Atom?

One thing that looks suspicious is that your binary is named "engine.exe". Although one can of course call a file anything one wants, that extension typically denotes a Windows executable.

Re: Problems compiling for x86 Android on Linux

Posted: Sun Mar 27, 2016 10:56 pm
by styx
yes, they do run fine.

and yeah, this "engine.exe" is very strange in the error message. but I can say for sure, that the engine binaries I am trying to load are native linux binaries. as mentioned, they run flawlessly under ubuntu in xboard, pychess and SCID

virustotal file info:
https://www.virustotal.com/de/file/2508 ... 459111929/

if needed, compiles I was testing are available here:

https://www.dropbox.com/sh/d8zcch9mngtl ... k-02a?dl=0

Re: Problems compiling for x86 Android on Linux

Posted: Mon Mar 28, 2016 7:05 pm
by abik
styx wrote:if needed, compiles I was testing are available here
All these binaries are dynamically linked. Did you try static linking (or PIC for that matter)?
See my previous posting on this topic.

Re: Problems compiling for x86 Android on Linux

Posted: Mon Mar 28, 2016 8:59 pm
by styx
How do I do it? Adding "-static" in the makefile under LDFLAGS generates a binary that throws a "memory access error" when I try to run it

Re: Problems compiling for x86 Android on Linux

Posted: Tue Mar 29, 2016 7:21 pm
by abik
styx wrote:How do I do it?
In a nutshell (don't forget the other flags of course, but this is to illustrate the differences).

Code: Select all

g++             aart.cc             ; dynamic
g++ -fPIE  -pie aart.cc             ; position-independent
g++ -static     aart.cc             ; static