lichess-org / lichobile

lichess.org mobile application
https://lichess.org/mobile
GNU General Public License v3.0
2.02k stars 318 forks source link

Build fails while compiling stockfish #1509

Closed cdietze closed 3 years ago

cdietze commented 3 years ago

Describe the bug I checked out the project and followed the build instructions. When building the android version from either Android Studio or using gradle on the command-line, the build fails while compiling stockfish.

This is the final output of running ./gradlew build in the android directory:

> Task :capacitor-stockfish:externalNativeBuildWithNNUEDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':capacitor-stockfish:externalNativeBuildWithNNUEDebug'.
> Build command failed.
  Error while executing process /Users/christoph/Library/Android/sdk/ndk/21.3.6528147/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/christoph/code/cpd/lichess/lichobile/node_modules/capacitor-stockfish/android/jni/Android.mk NDK_APPLICATION_MK=/Users/christoph/code/cpd/lichess/lichobile/node_modules/capacitor-stockfish/android/jni/Application.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/Users/christoph/code/cpd/lichess/lichobile/node_modules/capacitor-stockfish/android/build/intermediates/ndkBuild/withNNUEDebug/obj NDK_LIBS_OUT=/Users/christoph/code/cpd/lichess/lichobile/node_modules/capacitor-stockfish/android/build/intermediates/ndkBuild/withNNUEDebug/lib APP_CPPFLAGS+=-std=c++17 APP_CPPFLAGS+=-DUSE_PTHREADS APP_CPPFLAGS+=-DNDEBUG APP_CPPFLAGS+=-O3 APP_CPPFLAGS+=-DIS_64BIT APP_CPPFLAGS+=-DUSE_POPCNT APP_CPPFLAGS+=-DUSE_NEON stockfish}
  [arm64-v8a] Compile++      : stockfish <= stockfish-jni.cpp
  [arm64-v8a] Compile++      : stockfish <= thread.cpp
  [arm64-v8a] Compile++      : stockfish <= timeman.cpp
  [arm64-v8a] Compile++      : stockfish <= ucioption.cpp
  [arm64-v8a] Compile++      : stockfish <= evaluate_nnue.cpp
  [arm64-v8a] Compile++      : stockfish <= half_kp.cpp
  [arm64-v8a] Compile++      : stockfish <= misc.cpp
  [arm64-v8a] Compile++      : stockfish <= bitboard.cpp
  [arm64-v8a] Compile++      : stockfish <= psqt.cpp
  [arm64-v8a] Compile++      : stockfish <= benchmark.cpp
  [arm64-v8a] Compile++      : stockfish <= movepick.cpp
  [arm64-v8a] Compile++      : stockfish <= tune.cpp
  [arm64-v8a] Compile++      : stockfish <= tbprobe.cpp
  [arm64-v8a] Compile++      : stockfish <= bitbase.cpp
  [arm64-v8a] Compile++      : stockfish <= evaluate.cpp

  <inline asm>:6:9: error: Could not find incbin file 'nn-82215d0fd0df.nnue'
  .incbin "nn-82215d0fd0df.nnue"
          ^
  1 error generated.
  make: *** [/Users/christoph/Library/Android/sdk/ndk/21.3.6528147/build/core/build-binary.mk:478: /Users/christoph/code/cpd/lichess/lichobile/node_modules/capacitor-stockfish/android/build/intermediates/ndkBuild/withNNUEDebug/obj/local/arm64-v8a/objs/stockfish/__/__/stockfish/src/evaluate.o] Error 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 50s
125 actionable tasks: 2 executed, 123 up-to-date

I use macOS Big Sur.

cdietze commented 3 years ago

Running make net in /node_modules/capacitor-stockfish/stockfish/src downloads the nnue file and the gradle build actually succeeds afterwards.

Not sure why I needed that extra step. If it's necessary for android setup it should be documented.

Or running ./gradlew installWithoutNNUEDebug would probably not need the nnue file. I successfully installed the android app in a simulator this way.

veloce commented 3 years ago

Yes that's the way to do. I'd like to make withoutNNUE flavor the default, but haven't found yet how to do it.

cdietze commented 3 years ago

@veloce Just found that there is an option "isDefault", and I created a Pull Request for it: #1529