syzygy1 / Cfish

C port of Stockfish
GNU General Public License v3.0
137 stars 59 forks source link

Not able to compile with NDK for Android, while I can with Stockfish and similars (C++) #150

Closed ghost closed 4 years ago

ghost commented 4 years ago

I can perfectly compile Stockfish or CorChess, but I get error with Cfish. I suppose it's because of the C language. I have perfectly installed NDK.

max@max-virtual-machine:~$ export PATH=$PATH:/home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin max@max-virtual-machine:~$ cd Cfish-master/src/ max@max-virtual-machine:~/Cfish-master/src$ make build ARCH=armv7 COMP=ndk

Config: debug: 'no' sanitize: 'no' optimize: 'yes' arch: 'armv7' bits: '32' kernel: 'Linux' os: 'GNU/Linux' prefetch: 'yes' popcnt: 'no' pext: 'no' sse: 'no' mmx: 'no' sse2: 'no' ssse3: 'no' sse41: 'no' avx2: 'no' avx512: 'no' vnni: 'no' neon: 'no' native: 'no' embed: 'no'

Flags: CC: armv7a-linux-androideabi16-clang CFLAGS: -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DNUMA -DNNUE -fPIE LDFLAGS: -lm -pie -lm -latomic -lpthread -lnuma -fPIE -pie

Testing config sanity. If this fails, try 'make help' ...

make: *** [Makefile:910: config-sanity] Error 1 max@max-virtual-machine:~/Cfish-master/src$

syzygy1 commented 4 years ago

Thanks. Hopefuly this has now been fixed.

ghost commented 4 years ago

The compilations succeeded for armv7 and armv8, failed for armv7-neon. The binaries don't work on Android anyway. I have tried with the latest Stockfish beta and I was able to compile all the three flavours and all of them worked in play/analysis.

Compiling Cfish:

max@max-virtual-machine:~/Desktop/Cfish-master/src$ make build ARCH=armv7-neon COMP=ndk

Config: debug: 'no' sanitize: 'no' optimize: 'yes' arch: 'armv7' bits: '32' kernel: 'Linux' os: 'GNU/Linux' prefetch: 'yes' popcnt: 'yes' pext: 'no' sse: 'no' mmx: 'no' sse2: 'no' ssse3: 'no' sse41: 'no' avx2: 'no' avx512: 'no' vnni: 'no' neon: 'yes' native: 'no' embed: 'no'

Flags: CC: armv7a-linux-androideabi16-clang CFLAGS: -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE LDFLAGS: -lm -pie -lm -latomic -fPIE -pie

Testing config sanity. If this fails, try 'make help' ...

make ARCH=armv7-neon COMP=ndk all make[1]: Entering directory '/home/max/Desktop/Cfish-master/src' armv7a-linux-androideabi16-clang -o cfish benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o search.o tbprobe.o thread.o timeman.o tt.o uci.o ucioption.o numa.o settings.o polybook.o nnue.o -lm -pie -lm -latomic -fPIE -pie /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: benchmark.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: bitbase.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: bitboard.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: endgame.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: evaluate.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: main.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: material.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: misc.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: movegen.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: movepick.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: pawns.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: position.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: psqt.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: search.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: tbprobe.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: thread.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: timeman.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: tt.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: uci.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: ucioption.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: numa.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: settings.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: polybook.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: nnue.o: incompatible target /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/16/crtbegin_dynamic.o:crtbegin.c:function _start_main: error: undefined reference to 'main' clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [Makefile:918: cfish] Error 1 make[1]: Leaving directory '/home/max/Desktop/Cfish-master/src' make: [Makefile:803: build] Error 2


Compiling last Stockfish beta:

max@max-virtual-machine:~/Stockfish-master/src$ make build ARCH=armv7-neon COMP=ndk

Config: debug: 'no' sanitize: 'no' optimize: 'yes' arch: 'armv7' bits: '32' kernel: 'Linux' os: 'GNU/Linux' prefetch: 'yes' popcnt: 'yes' pext: 'no' sse: 'no' mmx: 'no' sse2: 'no' ssse3: 'no' sse41: 'no' avx2: 'no' avx512: 'no' vnni256: 'no' vnni512: 'no' neon: 'yes'

Flags: CXX: armv7a-linux-androideabi16-clang++ CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin LDFLAGS: -static-libstdc++ -pie -lm -latomic -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin

Testing config sanity. If this fails, try 'make help' ...

Default net: nn-308d71810dff.nnue Already available. make ARCH=armv7-neon COMP=ndk all make[1]: Entering directory '/home/max/Stockfish-master/src' armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o benchmark.o benchmark.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o bitbase.o bitbase.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o bitboard.o bitboard.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o endgame.o endgame.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o evaluate.o evaluate.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o main.o main.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o material.o material.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o misc.o misc.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o movegen.o movegen.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o movepick.o movepick.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o pawns.o pawns.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o position.o position.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o psqt.o psqt.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o search.o search.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o thread.o thread.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o timeman.o timeman.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o tt.o tt.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o uci.o uci.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o ucioption.o ucioption.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o tune.o tune.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o tbprobe.o syzygy/tbprobe.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o evaluate_nnue.o nnue/evaluate_nnue.cpp armv7a-linux-androideabi16-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin -c -o half_kp.o nnue/features/half_kp.cpp armv7a-linux-androideabi16-clang++ -o stockfish benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o search.o thread.o timeman.o tt.o uci.o ucioption.o tune.o tbprobe.o evaluate_nnue.o half_kp.o -static-libstdc++ -pie -lm -latomic -Wall -Wcast-qual -fno-exceptions -std=c++17 -stdlib=libc++ -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DUSE_PTHREADS -DNDEBUG -O3 -DUSE_POPCNT -DUSE_NEON -flto=thin make[1]: Leaving directory '/home/max/Stockfish-master/src'

sf-x commented 4 years ago

The compilations succeeded for armv7 and armv8, failed for armv7-neon. The binaries don't work on Android anyway.

/home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: nnue.o: incompatible target

Did you issue make clean command before?

ghost commented 4 years ago

I always do make clean after any compile attempt. So yes.

syzygy1 commented 4 years ago

Try without lto please.

I should probably remove LTO from the Makefile altogether, because I keep seeing questions from people who don't try it without LTO first.

syzygy1 commented 4 years ago

Oh I apologize for my previous comment!! I now see that It was Stockfish that was (successfully) built with -flto. Cfish was compiled with the flags specified in the Makefile.

syzygy1 commented 4 years ago

I fixed a typo. Please try if it helps.

ghost commented 4 years ago

None of them worked. armv7-neon got an odd compile output:

max@max-virtual-machine:~$ cd Cfish-master/src/ max@max-virtual-machine:~/Cfish-master/src$ make clean max@max-virtual-machine:~/Cfish-master/src$ make build ARCH=armv7-neon COMP=ndk

Config: debug: 'no' sanitize: 'no' optimize: 'yes' arch: 'armv7' bits: '32' kernel: 'Linux' os: 'GNU/Linux' prefetch: 'yes' popcnt: 'yes' pext: 'no' sse: 'no' mmx: 'no' sse2: 'no' ssse3: 'no' sse41: 'no' avx2: 'no' avx512: 'no' vnni: 'no' neon: 'yes' native: 'no' embed: 'no'

Flags: CC: armv7a-linux-androideabi16-clang CFLAGS: -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE LDFLAGS: -lm -pie -lm -latomic -fPIE -pie

Testing config sanity. If this fails, try 'make help' ...

make ARCH=armv7-neon COMP=ndk all make[1]: Entering directory '/home/max/Cfish-master/src' armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o benchmark.o benchmark.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o bitbase.o bitbase.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o bitboard.o bitboard.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o endgame.o endgame.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o evaluate.o evaluate.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o main.o main.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o material.o material.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o misc.o misc.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o movegen.o movegen.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o movepick.o movepick.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o pawns.o pawns.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o position.o position.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o psqt.o psqt.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o search.o search.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o tbprobe.o tbprobe.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o thread.o thread.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o timeman.o timeman.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o tt.o tt.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o uci.o uci.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o ucioption.o ucioption.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o numa.o numa.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o settings.o settings.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o polybook.o polybook.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -msse3 -mpopcnt -DUSE_POPCNT -DUSE_NEON -DNNUE -fPIE -c -o nnue.o nnue.c clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument] armv7a-linux-androideabi16-clang -o cfish benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o search.o tbprobe.o thread.o timeman.o tt.o uci.o ucioption.o numa.o settings.o polybook.o nnue.o -lm -pie -lm -latomic -fPIE -pie make[1]: Leaving directory '/home/max/Cfish-master/src' max@max-virtual-machine:~/Cfish-master/src$

ghost commented 4 years ago

I guess at this point I must share the way on how to compile for Android so that you can test it by yourself:

1) Install Linux, if not native I suggest on virtual machine (preferably the Linux Mint distribution)

2) Download and extract this package on in the Linux 'Home' folder: https://developer.android.com/ndk/downloads

3) Enable View->Show Hidden Files in the Linux default file manager

4) open the file .bashrc in edit mode, add this new line at the beginning:

export PATH=$PATH:/home/ronalddeman/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin

where ronalddeman is the Linux user (you can choose also "rdm" and use this in the strings instead)

5) save this text file

6) put the Cfish-master folder in Home

7) start the command line, type cd Cfish-master/src/

8) type make build ARCH=armv7 COMP=ndk to compile armv7

type /home/ronalddeman/ndk/android-ndk-r21d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin/strip cfish

to strip the program

type make build ARCH=armv7-neon COMP=ndk to compile armv7-neon

type /home/ronalddeman/ndk/android-ndk-r21d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin/strip cfish to strip the program

type make build ARCH=armv8 COMP=ndk to compile armv8

type /home/ronalddeman/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip cfish to strip the program

where ronalddeman is the linux user.

To test the binaries an Android phone or a virtual machine hosting Android are required.

syzygy1 commented 4 years ago

I already did that last week and could compile for armv8 without a problem. I did not yet try running it, though.

syzygy1 commented 4 years ago

The -mssse3 warning suggest a problem in the Makefile which I should be able to fix in a minute.

syzygy1 commented 4 years ago

I have fixed the -mssse3 problem and made some more changes. It should now be very close to SF"s Makefile is doing, which hopefully solves the problem. I have added -static to the NDK linker flags, that may be useful as well. When I have time I will try to test myself.

syzygy1 commented 4 years ago

I can now compile for ARCH=armv8 and the executable works via qemu. ARCH=armv7 and ARCH=armv7-neon now compile fine for me, but trying to run them gives a bionic error about the process's pid exceeding 65535. This seems to be a problem of the emulator.

syzygy1 commented 4 years ago

Hmm, bench is not correct for armv8. Seems to be a NNUE problem, so probably something with NEON.

syzygy1 commented 4 years ago

Node count is in fact correct. I compared with an old version.

ghost commented 4 years ago

Compilations fine, engines not working. Droidfish says "Engine terminated" while loading for all of them: armv7, armv7-neon, armv8.

syzygy1 commented 4 years ago

Did you set up the book correctly? At least armv8 works fine for me. If you have trouble with the book, compile with "embed=yes".

ghost commented 4 years ago

I don't use books as I'm only trying the engines. Try to disable the book and see if Cfish work. I am afraid the first moves are made by the GUI bound to the book.

syzygy1 commented 4 years ago

Sorry, I meant the NNUE network file, not the book. I suppose the engine quits because it cannot find that file.

Compiling with embed=yes will include the NNUE network file in the executable.

ghost commented 4 years ago

With embed=yes, latest source, armv8: Engine error: Failed to start engine

ghost commented 4 years ago

Tried to compile one of the penultimate versions with nnue=no in the Makefile, the engine doesn't start anyway although compiling perfectly.

Compiling the last one for armv8 gives this error, instead:

max@max-virtual-machine:~/Cfish-master/src$ make build ARCH=armv8 COMP=ndk

Config: debug: 'no' sanitize: 'no' optimize: 'yes' arch: 'armv8' bits: '64' kernel: 'Linux' os: 'GNU/Linux' prefetch: 'yes' popcnt: 'yes' pext: 'no' sse: 'no' mmx: 'no' sse2: 'no' ssse3: 'no' sse41: 'no' avx2: 'no' avx512: 'no' vnni: 'no' neon: 'yes' native: 'no' embed: 'no'

Flags: CC: aarch64-linux-android21-clang CFLAGS: -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE LDFLAGS: -lm -static -latomic -z muldefs

Testing config sanity. If this fails, try 'make help' ...

make ARCH=armv8 COMP=ndk all make[1]: Entering directory '/home/max/Cfish-master/src' aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o benchmark.o benchmark.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o bitbase.o bitbase.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o bitboard.o bitboard.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o endgame.o endgame.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o evaluate.o evaluate.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o main.o main.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o material.o material.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o misc.o misc.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o movegen.o movegen.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o movepick.o movepick.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o pawns.o pawns.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o position.o position.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o psqt.o psqt.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o search.o search.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o tbprobe.o tbprobe.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o thread.o thread.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o timeman.o timeman.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o tt.o tt.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o uci.o uci.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o ucioption.o ucioption.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o numa.o numa.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o settings.o settings.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o polybook.o polybook.c aarch64-linux-android21-clang -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -c -o nnue.o nnue.c nnue.c:410:30: error: use of undeclared identifier 'numChunks' for (unsigned j = 0; j < numChunks; j++) { ^ nnue.c:1174:18: error: redefinition of 'numChunks' const unsigned numChunks = kHalfDimensions / 8; ^ nnue.c:1138:18: note: previous definition is here const unsigned numChunks = (16 * kHalfDimensions) / SIMD_WIDTH; ^ 2 errors generated. make[1]: [: nnue.o] Error 1 make[1]: Leaving directory '/home/max/Cfish-master/src' make: [Makefile:813: build] Error 2 max@max-virtual-machine:~/Cfish-master/src$

In Windows the last Cfish has a monstrous power: depth 37 in only one minute of analysis on the starting position on a quad-core, never had such a tremendous result before.

syzygy1 commented 4 years ago

Fixed. I have attached an armv8 binary that runs fine under qemu. I did not yet test it on my phone.

cfish-armv8.zip

JavaMast commented 4 years ago

@syzygy1 can you please make it with embed network?

syzygy1 commented 4 years ago

@JavaMast Good point

cfish-armv8.zip

syzygy1 commented 4 years ago

On my Galaxy S9+ it works fine for me with DroidFish. I am getting about 330knps when searching from the start position (1 thread).

Unfortunately I can't yet get it to run from a terminal because the file isn't executable and chmod doesn't work. I'd like to do a bench.

JavaMast commented 4 years ago

@syzygy1 Thank you! People also asking for arm7 compilation. Is is possible?

ghost commented 4 years ago

@syzygy1 It works flawlessly. Can I know the entire command line you used and the Makefile modifications, please?

syzygy1 commented 4 years ago

make cfish COMP=ndk COMPCC="/path/to/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android21" ARCH=armv8 numa=no embed=yes

where /path/to is the path to where you extracted the NDK archive. Not very elegant but it works.

syzygy1 commented 4 years ago

aarch-64-linux-android21-clang instead of "clang --target=aarch64-linux-android21" works too.

EDIT: If you first add /path/to/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin to the $PATH variable, you can simply type make cfish COMP=ndk ARCH=armv8 numa=no embed=yes. (In the first version of this comment I wrote that did not work, but I had forgotten to add ARM=armv8.)

So in bash: export PATH=$PATH:/path/to/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin Or add this line to ~/.bashrc

Obviously you have to replace /path/to with /home/username or wherever you extracted the archive to.

Unfortunately make pgo still does not work (even after installing qemu and configuring Linux to invoke qemu to run ARM binaries). Cannot find -lgcov.

syzygy1 commented 4 years ago

OK, the -lgcov problem is a Makefile problem which is also present in SF"s Makefile.

Fixing it makes "make pgo COMP=ndk ARCH=armv8 numa=no embed=yes" almost work. Unfortunately, the instrumented cfish binary crashes on exit: qemu: uncaught target signal 11 (Segmentation fault) - core dumped

syzygy1 commented 4 years ago

It seems LTO is beneficial for clang/ARM (I never get any real benefit from it on x86_64/gcc with Cfish).

cfish-armv8.zip

AlexB123 commented 4 years ago

It seems LTO is beneficial for clang/ARM (I never get any real benefit from it on x86_64/gcc with Cfish).

cfish-armv8.zip

I told you lto and popcnt increase speed :-)

AlexB123 commented 4 years ago

I guess at this point I must share the way on how to compile for Android so that you can test it by yourself:

1. Install Linux, if not native I suggest on virtual machine (preferably the Linux Mint distribution)

2. Download and extract this package on in the Linux 'Home' folder: 

Is this a Linux (virtualbox) on Windows? Did you install VirtualBox 6.0.24 before you install the Linux Mint 20 (Cinnamon (64-bit))?

ghost commented 4 years ago

Compiled with

make cfish COMP=ndk COMPCC="/home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android21" ARCH=armv8 numa=no embed=yes lto=yes

/home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip cfish

It works flawlessly on DroidFish but on AcidApe can't be installed because "The selected file could not be registered as an engine. Either it is not an UCI or CECP arm64-v8a engine binary, or an I/O error occured".

The binary @syzygy1 linked here can be installed on AcidApe instead, and the official Stockfish 12 for Android too. Where is the mistake?

syzygy1 commented 4 years ago

I don't know, I see no difference. I think I also stripped it.

ghost commented 4 years ago

Not sure if I have to write it here or I have to start another issue thread: I am getting an error compiling for armv7 with the last source.

max@max-virtual-machine:/mnt/hgfs/Massimiliano Goi/Cfish-master/src$ make cfish COMP=ndk COMPCC="/home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21" ARCH=armv7 numa=no embed=yes lto=yes

/home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o benchmark.o benchmark.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o bitbase.o bitbase.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o bitboard.o bitboard.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o endgame.o endgame.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o evaluate.o evaluate.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o main.o main.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o material.o material.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o misc.o misc.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o movegen.o movegen.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o movepick.o movepick.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o pawns.o pawns.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o position.o position.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o psqt.o psqt.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o search.o search.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o tbprobe.o tbprobe.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o thread.o thread.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o timeman.o timeman.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o tt.o tt.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o uci.o uci.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o ucioption.o ucioption.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o numa.o numa.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o settings.o settings.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o polybook.o polybook.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o nnue.o nnue.c nnue.c:537:13: warning: unused function 'next_idx' [-Wunused-function] INLINE bool next_idx(unsigned idx, unsigned offset, uint64_t *v, ^ 1 warning generated. /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -o cfish benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o search.o tbprobe.o thread.o timeman.o tt.o uci.o ucioption.o numa.o settings.o polybook.o nnue.o -lm -static -latomic -z muldefs -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -fPIE /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: fatal error: cfish: Input/output error clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Makefile:933: cfish] Error 1 max@max-virtual-machine:/mnt/hgfs/Massimiliano Goi/Cfish-master/src$

max@max-virtual-machine:/mnt/hgfs/Massimiliano Goi/Cfish-master/src$ make cfish COMP=ndk COMPCC="/home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21" ARCH=armv7 numa=no embed=yes lto=yes /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o benchmark.o benchmark.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o bitbase.o bitbase.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o bitboard.o bitboard.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o endgame.o endgame.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o evaluate.o evaluate.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o main.o main.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o material.o material.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o misc.o misc.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o movegen.o movegen.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o movepick.o movepick.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o pawns.o pawns.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o position.o position.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o psqt.o psqt.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o search.o search.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o tbprobe.o tbprobe.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o thread.o thread.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o timeman.o timeman.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o tt.o tt.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o uci.o uci.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o ucioption.o ucioption.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o numa.o numa.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o settings.o settings.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o polybook.o polybook.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -c -o nnue.o nnue.c nnue.c:537:13: warning: unused function 'next_idx' [-Wunused-function] INLINE bool next_idx(unsigned idx, unsigned offset, uint64_t *v, ^ 1 warning generated. /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -o cfish benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o search.o tbprobe.o thread.o timeman.o tt.o uci.o ucioption.o numa.o settings.o polybook.o nnue.o -lm -static -latomic -z muldefs -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DNDEBUG -O3 -DNNUE -DNNUE_EMBEDDED -flto=thin -fPIE -fPIE /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: fatal error: cfish: Input/output error clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Makefile:933: cfish] Error 1 max@max-virtual-machine:/mnt/hgfs/Massimiliano Goi/Cfish-master/src$

Same thing for make build ARCH=armv7 COMP=ndk

syzygy1 commented 4 years ago

No error here, only the warning (which is innocent).

Perhaps it helps to use -androideabi16 instead of -androideba21 for arm7v. Don't know if that helps, but it is what SF uses and also what is in the Cfish Makefile.

I would suggest you add /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin to your PATH variable. Then you can leave out the COMPCC=... from the make command.

syzygy1 commented 4 years ago

Same thing for make build ARCH=armv7 COMP=ndk

OK, so you may already have set your PATH variable. I think you still need to add numa=no to it, but this won't solve the "Input/output error".

syzygy1 commented 4 years ago

It seems the "Input/output error" has to do with bugs in the NDK, which apparently vary from abi to abi: https://stackoverflow.com/questions/31573965/input-output-error-using-android-ndk-build Perhaps there is a solution there. And make sure you try the ones that are in the Makefile.

ghost commented 4 years ago

Correcting myself: the last source binary doesn't work in Droidfish either, compiling with --target=aarch64-linux-android21.

Compiling with --target=aarch64-linux-android16 gives me this error:

max@max-virtual-machine : ~ /Cfish-master/src$ make cfish COMP=ndk COMPCC="/home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16" ARCH=armv8 numa=no embed=yes /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o benchmark.o benchmark.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o bitbase.o bitbase.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o bitboard.o bitboard.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o endgame.o endgame.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o evaluate.o evaluate.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o main.o main.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o material.o material.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o misc.o misc.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o movegen.o movegen.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o movepick.o movepick.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o pawns.o pawns.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o position.o position.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o psqt.o psqt.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o search.o search.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o tbprobe.o tbprobe.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o thread.o thread.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o timeman.o timeman.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o tt.o tt.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o uci.o uci.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o ucioption.o ucioption.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o numa.o numa.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o settings.o settings.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o polybook.o polybook.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin -c -o nnue.o nnue.c /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android16 -o cfish benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o search.o tbprobe.o thread.o timeman.o tt.o uci.o ucioption.o numa.o settings.o polybook.o nnue.o -lm -static -latomic -z muldefs -Wall -std=c11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -fPIE -DNDEBUG -O3 -DIS_64BIT -DUSE_POPCNT -DUSE_NEON -DNNUE -DNNUE_EMBEDDED -flto=thin /home/max/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find crtbegin_static.o: No such file or directory clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Makefile:933: cfish] Error 1 max@max-virtual-machine:~/Cfish-master/src$

ghost commented 4 years ago

Ok, found the issue: I was perfectly able to compile with

  1. make build ARCH=armv7 COMP=ndk
  2. make build ARCH=armv7-neon COMP=ndk
  3. make build ARCH=armv8 COMP=ndk

The problem was that I was transferring the binary using my website as a bridge and somewhat the Chrome browser of the phone corrupted it because of some bug; by transferring it as RAR archive once extracted it worked flawlessly.

Great job, @syzygy1 , really great job! Thank you very much.

I can say that everything has been answered and fixed, so I can close this thread.

syzygy1 commented 4 years ago

And thank you for your help :+1: