Closed MisesEnForce closed 4 years ago
@MisesEnForce I think so far we have had nobody on the regular developers team with Android experience to improve and maintain the makefile. Help would be welcome, so eventually we have a working Android Makefile.
The aligned_alloc issue should be fixed with current master.
Can I ask to take your Makefile changes to the issue https://github.com/official-stockfish/Stockfish/issues/2860 , in the hope that this eventually leads to a pull request.
@MisesEnForce I think so far we have had nobody on the regular developers team with Android experience to improve and maintain the makefile. Help would be welcome, so eventually we have a working Android Makefile.
The aligned_alloc issue should be fixed with current master.
Can I ask to take your Makefile changes to the issue #2860 , in the hope that this eventually leads to a pull request.
Many thx for fixing the aligned memory allocation issue !
Actually I tried to compile stockfish on my android phone. (With the tools (terminal, compiler etc) provided by the termux app.) With this, stockfish works on the command line on the phone, but not when used in the DroidFish app, which does not satisfy me. I would like next to try to cross compile it (with the toolchain provided with the android sdk) for my android and see if then it works within the DroidFish app. I will take my changes to the makefile (after having made them generic, i.e. not only working for my phone) + add a text tutorial for the cross-build (if it succeeds, fingers crossed).
not working in the droidfish app could be related to not finding the network file (if it works for classical eval but not for NNUE). The EvalFile
argument must be the full path to the file, or the file must be in the working directory of the running engine (which is not always where the engine is, depending on GUI).
not working in the droidfish app could be related to not finding the network file (if it works for classical eval but not for NNUE). The
EvalFile
argument must be the full path to the file, or the file must be in the working directory of the running engine (which is not always where the engine is, depending on GUI).
Hum, that's what I though at some point (as I had an analogue issue with lc0) but discarded (don't know why now) the hypothesis, and havent' tried. I will rebuild with the last master and without -D__ANDROID_API__=28
(which bans millions of android devices ...) and try.
The current master doesn't fix the aligned_alloc
issue, without -D__ANDROID_API__=28
I still have :
And now with it I also have the same issue ...
wait.. that's not current master the code on master looks different.
void* std_aligned_alloc(size_t alignment, size_t size) {
#if defined(POSIXALIGNEDALLOC)
void *pointer;
if(posix_memalign(&pointer, alignment, size) == 0)
return pointer;
return nullptr;
#elif defined(_WIN32)
return _mm_malloc(size, alignment);
#else
return std::aligned_alloc(alignment, size);
#endif
}
wait.. that's not current master the code on master looks different.
void* std_aligned_alloc(size_t alignment, size_t size) { #if defined(POSIXALIGNEDALLOC) void *pointer; if(posix_memalign(&pointer, alignment, size) == 0) return pointer; return nullptr; #elif defined(_WIN32) return _mm_malloc(size, alignment); #else return std::aligned_alloc(alignment, size); #endif }
You are right, I think I somehow failed in the git reset --hard + fetch + rebase. I got the latest master and compiled it without the -D__ANDROID_API__=28
bit but with my other Makefile changes, and it compiled fine. It works in the terminal as it did. I move the executable + the nn-112bb1c8cdb5.nnue file in DroidFish and it still fails to start the engine :
To be more precise, when "there's no problem in droidfish with an engine" (I know it is vague), it does not trigger the "failed to start engine", and you can later access engine options to point to some network file (for lc0 for instance) if needed. Here you can't. So I really suspect there's something inaccurate in my compilation that makes the engine work "inside" the termux terminal, but not within a standard GUI. I will try to cross compile it with android SDK/NDK to see.
I agree, that error message is not due to the net not being available
Hello,
I have seen several issues of the type "cannot compile for android", some being closed, other being left for dead, all without any proper response.
I am using gcc 8.4.0.
I took your Makefile and tweaked it as follows :
(The
-D__ANDROID_API__=28
because without it I haveerror: 'aligned_alloc' was not declared in this scope
issues ...)I don't understand why you override, when os is android, the armv8 into arvm7 and why you give invalid compiler options (-mthum, -mfloat-abi, or -m64). Did you test these compilations on an android device ?
The produced executable works in a termux android terminal but triggers a "fail to start engine" inside Droidfish, which is a sufficiently thrustable app for me (it runs an lc0 with big nets, several other engines etc) to be sure that there must be a problem with the compilation even if it works in the termux terminal. But I don't see which problem it could be. I put the compilation log below.
Could you please provide the exact makefile you used (with options (arch etc))) you used to build stockfish on an android os, if you did ?
I think that there is a huge number of people trying to do what I tried, without success, so that it would really be useful to have a clear stance from you on this.
Compilation log :