mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 20:57:10 +00:00
Update to the latest LTS version NDK r27c (27.2.12479018), the previous NDK are unsupported by Google, see: https://developer.android.com/ndk/downloads A build with NDK r27c and API level < 29 returns this error: "executable's TLS segment is underaligned: alignment is 8 (skew 0), needs to be at least 64 for ARM64 Bionic" Update the API level to 29 to use the native ELF LTS and avoid the error: https://android.googlesource.com/platform/bionic/+/HEAD/docs/elf-tls.md https://android.googlesource.com/platform/bionic/+/HEAD/android-changes-for-ndk-developers.md#elf-tls-available-for-api-level-29 A dynamic link build of Stockfish uses these libraries: ldd stockfish-android-armv8-dynamic-api35 libm.so => /system/lib64/libm.so libdl.so => /system/lib64/libdl.so libc.so => /system/lib64/libc.so ld-android.so => /system/lib64/ld-android.so ld-android.so : the dynamic linker used by Android (on Linux is named ld-linux.so), responsible for loading and linking shared libraries into an executable at runtime. libdl.so : interface/library layer that provides function for dynamic loading, relies on the underlying functionality provided by the dynamic linker libm.so : math library for Android libc.so : standard C library for Android References: Doc for native (C/C++) API https://developer.android.com/ndk/guides/stable_apis C libraries (libc, libm, libdl): https://developer.android.com/ndk/guides/stable_apis#c_library Bionic changes with API levels: https://android.googlesource.com/platform/bionic/+/HEAD/docs/status.md NDK r27c build system: https://android.googlesource.com/platform/ndk/+/ndk-r27-release/docs/BuildSystemMaintainers.md CI: Update to NDK r27c (27.2.12479018), the default version in GitHub runner, to switch to a recent clang 18. A PGO build requires static linking, because the NDK doesn't ship the Android loaders (linker/linker64), see: https://groups.google.com/g/android-ndk/c/3Ep6zD3xxSY The API level should not be an issue when distributing a static build, use the API 29, the oldest one not affected by the LTS alignement issue. closes https://github.com/official-stockfish/Stockfish/pull/6081 No functional change
99 lines
3.1 KiB
YAML
99 lines
3.1 KiB
YAML
name: Compilation
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
matrix:
|
|
type: string
|
|
required: true
|
|
jobs:
|
|
Compilation:
|
|
name: ${{ matrix.config.name }} ${{ matrix.binaries }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
env:
|
|
COMPCXX: ${{ matrix.config.compiler }}
|
|
COMP: ${{ matrix.config.comp }}
|
|
EMU: ${{ matrix.config.emu }}
|
|
EXT: ${{ matrix.config.ext }}
|
|
BINARY: ${{ matrix.binaries }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(inputs.matrix) }}
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
shell: ${{ matrix.config.shell }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Download required linux packages
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install qemu-user
|
|
|
|
- name: Install NDK
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
if [ $COMP == ndk ]; then
|
|
NDKV="27.2.12479018"
|
|
ANDROID_ROOT=/usr/local/lib/android
|
|
ANDROID_SDK_ROOT=$ANDROID_ROOT/sdk
|
|
SDKMANAGER=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager
|
|
echo "y" | $SDKMANAGER "ndk;$NDKV"
|
|
ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/$NDKV
|
|
ANDROID_NDK_BIN=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin
|
|
echo "ANDROID_NDK_BIN=$ANDROID_NDK_BIN" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Extract the bench number from the commit history
|
|
run: |
|
|
for hash in $(git rev-list -100 HEAD); do
|
|
benchref=$(git show -s $hash | tac | grep -m 1 -o -x '[[:space:]]*\b[Bb]ench[ :]\+[1-9][0-9]\{5,7\}\b[[:space:]]*' | sed 's/[^0-9]//g') && break || true
|
|
done
|
|
[[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found"
|
|
|
|
- name: Download the used network from the fishtest framework
|
|
run: make net
|
|
|
|
- name: Check compiler
|
|
run: |
|
|
if [ $COMP == ndk ]; then
|
|
export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
|
|
fi
|
|
$COMPCXX -v
|
|
|
|
- name: Test help target
|
|
run: make help
|
|
|
|
- name: Check git
|
|
run: git --version
|
|
|
|
# Compile profile guided builds
|
|
|
|
- name: Compile ${{ matrix.binaries }} build
|
|
run: |
|
|
if [ $COMP == ndk ]; then
|
|
export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
|
|
export LDFLAGS="-static -Wno-unused-command-line-argument"
|
|
fi
|
|
make clean
|
|
make -j4 profile-build ARCH=$BINARY COMP=$COMP WINE_PATH=$EMU
|
|
make strip ARCH=$BINARY COMP=$COMP
|
|
WINE_PATH=$EMU ../tests/signature.sh $benchref
|
|
mv ./stockfish$EXT ../stockfish-android-$BINARY$EXT
|
|
|
|
- name: Remove non src files
|
|
run: git clean -fx
|
|
|
|
- name: Upload artifact for (pre)-release
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.config.simple_name }} ${{ matrix.binaries }}
|
|
path: |
|
|
.
|
|
!.git
|
|
!.output
|