Problems compiling for x86 Android on Linux

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

styx
Posts: 338
Joined: Tue Mar 13, 2012 9:59 pm
Location: Germany

Problems compiling for x86 Android on Linux

Post 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!
User avatar
stegemma
Posts: 859
Joined: Mon Aug 10, 2009 10:05 pm
Location: Italy
Full name: Stefano Gemma

Re: Problems compiling for x86 Android on Linux

Post by stegemma »

Maybe you need to run "chmod +x engine.exe"?
Author of Drago, Raffaela, Freccia, Satana, Sabrina.
http://www.linformatica.com
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Problems compiling for x86 Android on Linux

Post 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.
styx
Posts: 338
Joined: Tue Mar 13, 2012 9:59 pm
Location: Germany

Re: Problems compiling for x86 Android on Linux

Post 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!
Gurcan Uckardes
Posts: 196
Joined: Wed Oct 29, 2014 12:42 am

Re: Problems compiling for x86 Android on Linux

Post 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.
My blog for Android users: http://chesstroid.blogspot.com
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Problems compiling for x86 Android on Linux

Post 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.
styx
Posts: 338
Joined: Tue Mar 13, 2012 9:59 pm
Location: Germany

Re: Problems compiling for x86 Android on Linux

Post 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
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Problems compiling for x86 Android on Linux

Post 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.
styx
Posts: 338
Joined: Tue Mar 13, 2012 9:59 pm
Location: Germany

Re: Problems compiling for x86 Android on Linux

Post 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
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Problems compiling for x86 Android on Linux

Post 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