Closed vondele closed 4 years ago
Detecting musl will be very hard considering we support crosscompiling to target platforms that might have musl (we have to detect runtime features as opposed to compile-time features). IMO the easiest solution would be to always use NativeThread
assuming it doesn't cause unacceptable performance loss on Linux.
but not every system is posix (pthreads), so we can't (MSVC)
I would first fix it for native...
MUSL has no flags to detect into features:
https://git.musl-libc.org/cgit/musl/tree/include/features.h
But glibc has __GLIBC__
, uclibc has __GLIBC__
and __UCLIBC__
:
https://git.uclibc.org/uClibc/tree/include/features.h
and diet libc has __dietlibc__
So if we can't find any flag-feature then assume musl for Linux..
After enabling (monkey style) the custom NativeThread, stockfish seems to work fine in Alpine 3.12 (lxd/lxc):
CXXFLAGS=-U_FORTIFY_SOURCE make -j profile-build ARCH=x86-64-modern COMP=gcc
Add that CXXFLAGS to use LTO: https://gitlab.alpinelinux.org/alpine/aports/-/issues/8626
Looks a little bit ugly with find
and ldd
, but might be usefull: https://gist.github.com/unmanned-player/f2421eec512d610116f451249cce5920
Also, fetching info from ldd
might not work well on some systems: https://github.com/crystal-lang/crystal/pull/8330/files#diff-474782dad9befca4008fbcc8a4887083R68 (Obsolte Alpine Linux in this example)
That's too ugly, and obviously can't be done in the sources. However, reading here: https://wiki.musl-libc.org/functional-differences-from-glibc.html Maybe you can pass linking options: -Wl,-z,stack-size=N I'm not sure this will work, i.e. if it also changes the stack size of created threads. But maybe you can give it a try. Edit: see also https://git.musl-libc.org/cgit/musl/commit/?id=7b3348a98c139b4
so, cleaner, we add a defined(USE_PTHREADS) to the sources, and in the Makefile we add this to the CXXFLAGS at the point where we add -lpthread to the LDFLAGS. Remains to be seen if we would regress on linux, but I'd hope it doesn't.
This works quite well on the latest Alpine:
$ LDFLAGS='-Wl,-z,stack-size=0xA0000' make build
No segfaults on bench using big depths. 👍 Lowest stack size that not segfaults on my setup was 640KB.
$ ./stockfish bench 1024 16 30
===========================
Total time (ms) : 237709
Nodes searched : 5220865944
Nodes/second : 21963265
The lowest stack size is much larger, but you'll only find that once depth reaches the maximum (~245) (stacksize usage is roughly proportional to depth). We set the stacksize to 8MB on other systems. I've also started at test to see if we can just the other option of using pthreads api more generally : https://tests.stockfishchess.org/tests/view/5f402b5587a5c3c63d8f534d
The lowest stack size is much larger. Stacksize usage is roughly proportional to depth
Agreed, yeah, that make sense. My assumption above is wrong :-)
@Dantist I do need to set CXXFLAGS=-U_FORTIFY_SOURCE
as mentioned above, using gcc version 9.3.0 (Alpine 9.3.0)
on Alpine 3.12. If you don't need this, what version are you on? Since the problem is in a header file, I think it is unrelated to Stockfish.
/usr/include/c++/9.3.0/ext/string_conversions.h: In function '__to_xstring.constprop':
/usr/include/fortify/stdio.h:70:28: error: inlining failed in call to always_inline 'vsnprintf': function body can be overwritten at link time
70 | _FORTIFY_FN(vsnprintf) int vsnprintf(char *__s, size_t __n, const char *__f,
| ^
/usr/include/c++/9.3.0/ext/string_conversions.h:111:32: note: called from here
111 | const int __len = __convf(__s, __n, __fmt, __args);
| ^
make[2]: *** [/tmp/ccpiEJDA.mk:2: /tmp/stockfish.CHfENb.ltrans0.ltrans.o] Error 1
No, I don't need any additional CXXFLAGS
..
# cat /etc/alpine-release
3.12.0
Steps to compile:
$ docker run --rm -it alpine:latest sh
/ # apk add git make g++
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/22) Upgrading musl (1.1.24-r8 -> 1.1.24-r9)
(2/22) Installing libgcc (9.3.0-r2)
(3/22) Installing libstdc++ (9.3.0-r2)
(4/22) Installing binutils (2.34-r1)
(5/22) Installing gmp (6.2.0-r0)
(6/22) Installing isl (0.18-r0)
(7/22) Installing libgomp (9.3.0-r2)
(8/22) Installing libatomic (9.3.0-r2)
(9/22) Installing libgphobos (9.3.0-r2)
(10/22) Installing mpfr4 (4.0.2-r4)
(11/22) Installing mpc1 (1.1.0-r1)
(12/22) Installing gcc (9.3.0-r2)
(13/22) Installing musl-dev (1.1.24-r9)
(14/22) Installing libc-dev (0.7.2-r3)
(15/22) Installing g++ (9.3.0-r2)
(16/22) Installing ca-certificates (20191127-r4)
(17/22) Installing nghttp2-libs (1.41.0-r0)
(18/22) Installing libcurl (7.69.1-r0)
(19/22) Installing expat (2.2.9-r1)
(20/22) Installing pcre2 (10.35-r0)
(21/22) Installing git (2.26.2-r0)
(22/22) Installing make (4.3-r0)
Executing busybox-1.31.1-r16.trigger
Executing ca-certificates-20191127-r4.trigger
OK: 216 MiB in 35 packages
/ # git clone https://github.com/official-stockfish/Stockfish.git
Cloning into 'Stockfish'...
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 27840 (delta 2), reused 5 (delta 2), pack-reused 27829
Receiving objects: 100% (27840/27840), 11.90 MiB | 14.05 MiB/s, done.
Resolving deltas: 100% (21222/21222), done.
/ # cd Stockfish/src
/Stockfish/src # LDFLAGS='-Wl,-z,stack-size=0xA0000' make build
Config:
debug: 'no'
sanitize: 'no'
optimize: 'yes'
arch: 'x86_64'
bits: '64'
kernel: 'Linux'
os: 'Linux'
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'yes'
mmx: 'no'
sse2: 'yes'
ssse3: 'yes'
sse41: 'yes'
avx2: 'no'
avx512: 'no'
vnni: 'no'
neon: 'no'
Flags:
CXX: g++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto
LDFLAGS: -Wl,-z,stack-size=0xA0000 -m64 -Wl,--no-as-needed -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -flto=jobserver
Testing config sanity. If this fails, try 'make help' ...
make ARCH=x86-64-modern COMP=gcc all
make[1]: Entering directory '/Stockfish/src'
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o benchmark.o benchmark.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o bitbase.o bitbase.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o bitboard.o bitboard.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o endgame.o endgame.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o evaluate.o evaluate.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o main.o main.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o material.o material.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o misc.o misc.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o movegen.o movegen.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o movepick.o movepick.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o pawns.o pawns.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o position.o position.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o psqt.o psqt.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o search.o search.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o thread.o thread.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o timeman.o timeman.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o tt.o tt.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o uci.o uci.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o ucioption.o ucioption.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o tune.o tune.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o tbprobe.o syzygy/tbprobe.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o evaluate_nnue.o nnue/evaluate_nnue.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -c -o half_kp.o nnue/features/half_kp.cpp
g++ -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 -Wl,-z,stack-size=0xA0000 -m64 -Wl,--no-as-needed -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -flto=jobserver -m64 -Wl,--no-as-needed -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -flto=jobserver
make[1]: Leaving directory '/Stockfish/src'
/Stockfish/src # make net
Default net: nn-82215d0fd0df.nnue
Downloading https://tests.stockfishchess.org/api/nn/nn-82215d0fd0df.nnue
/Stockfish/src # ./stockfish bench >/dev/null
.....
===========================
Total time (ms) : 1740
Nodes searched : 3849173
Nodes/second : 2212168
/Stockfish/src # ./stockfish compiler
Stockfish 210820 by the Stockfish developers (see AUTHORS file)
Compiled by g++ (GNUC) 9.3.0 on Linux
Compilation settings include: 64bit SSE41 SSSE3 SSE2 POPCNT
__VERSION__ macro expands to: 9.3.0
/Stockfish/src # g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-alpine-linux-musl/9.3.0/lto-wrapper
Target: x86_64-alpine-linux-musl
Configured with: /home/buildozer/aports/main/gcc/src/gcc-9.3.0/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl --target=x86_64-alpine-linux-musl --with-pkgversion='Alpine 9.3.0' --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie --enable-default-ssp --enable-cloog-backend --enable-languages=c,c++,d,objc,fortran,ada --disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer --enable-shared --enable-threads --enable-tls --with-system-zlib --with-linker-hash-style=gnu
Thread model: posix
gcc version 9.3.0 (Alpine 9.3.0)
/Stockfish/src # ldd --version
musl libc (x86_64)
Version 1.1.24
Dynamic Program Loader
Usage: /lib/ld-musl-x86_64.so.1 [options] [--] pathname
/Stockfish/src #
I realized that Alpine image don't have fortify-headers
installed and don't install it with g++
.
It seems not needed to build the Stockfish, but if I do explicitly apk add fortify-headers
, then linking will fail:
g++ -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 -Wl,-z,stack-size=0xA0000 -m64 -Wl,--no-as-needed -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -flto=jobserver -m64 -Wl,--no-as-needed -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -flto=jobserver
/usr/include/c++/9.3.0/ext/string_conversions.h: In function '__to_xstring.constprop':
/usr/include/fortify/stdio.h:70:28: error: inlining failed in call to always_inline 'vsnprintf': function body can be overwritten at link time
70 | _FORTIFY_FN(vsnprintf) int vsnprintf(char *__s, size_t __n, const char *__f,
| ^
/usr/include/c++/9.3.0/ext/string_conversions.h:111:32: note: called from here
111 | const int __len = __convf(__s, __n, __fmt, __args);
| ^
make[2]: *** [/tmp/ccmHGbpC.mk:2: /tmp/stockfish.BIPAgc.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:800: stockfish] Error 1
make[1]: Leaving directory '~/stockfish/src'
make: *** [Makefile:675: build] Error 2
CXXFLAGS=-U_FORTIFY_SOURCE
helps to get things done, when fortify-headers
are installed. I assume this flag just disables what fortify-headers
do (and has no side effects, when fortify-headers
is missing), so it is safe to use in any case. ("Safe" to disable the macro, which adds more safety :-))
After enabling (monkey style) the custom NativeThread, stockfish seems to work fine in Alpine 3.12 (lxd/lxc):
CXXFLAGS=-U_FORTIFY_SOURCE make -j profile-build ARCH=x86-64-modern COMP=gcc
@ppigazzini , I now realized that since this command launches stockfish executable, then in your case it has not segfaulted simply by adding CXXFLAGS = -U_FORTIFY_SOURCE
? This is not the case on my setup. This flag helps to compile the binary, when fortify-headers
installed, but it segfaults anyway, unless LDFLAGS='-Wl,-z,stack-size=N'
is added.
@Dantist no @ppigazzini also modified the sources by hand. Anyway, the test passed to use pthreads more generally, I'll go with my patch which avoid the additional linking params, which are a source of errors. The fortify issue is a bug in the distro, I would say, and should be reported upstream.
@Dantist apk add build-base
installs fortify-headers
(18/20) and triggers the link error, so better to use apk add g++ make
(and add a comment somewhere about that).
~ # apk add build-base
(1/20) Installing libgcc (9.3.0-r2)
(2/20) Installing libstdc++ (9.3.0-r2)
(3/20) Installing binutils (2.34-r1)
(4/20) Installing libmagic (5.38-r0)
(5/20) Installing file (5.38-r0)
(6/20) Installing gmp (6.2.0-r0)
(7/20) Installing isl (0.18-r0)
(8/20) Installing libgomp (9.3.0-r2)
(9/20) Installing libatomic (9.3.0-r2)
(10/20) Installing libgphobos (9.3.0-r2)
(11/20) Installing mpfr4 (4.0.2-r4)
(12/20) Installing mpc1 (1.1.0-r1)
(13/20) Installing gcc (9.3.0-r2)
(14/20) Installing musl-dev (1.1.24-r9)
(15/20) Installing libc-dev (0.7.2-r3)
(16/20) Installing g++ (9.3.0-r2)
(17/20) Installing make (4.3-r0)
(18/20) Installing fortify-headers (1.1-r0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(19/20) Installing patch (2.7.6-r6)
(20/20) Installing build-base (0.5-r2)
Executing busybox-1.31.1-r19.trigger
OK: 209 MiB in 39 packages
@vondele, Thank you, the patch worked for me!
The fortify issue is a bug in the distro, I would say, and should be reported upstream.
Just want to let you know, that they didn't treat it as a bug, but they can be wrong: https://gitlab.alpinelinux.org/alpine/aports/-/issues/8626#note_63834
I've seen that issue as well, but in that case they should reconsider how they implement the std library? Anyway, if you figure out why this happens, we could consider a workaround.
Note, btw that on e.g. ubuntu linux the same fortify option doesn't lead to the error.
unrelated to NNUE, but the code fails to run on Linux systems based on musl instead of glibc:
https://groups.google.com/g/fishcooking/c/SdG6uNoWu3U
needs enabling our custom NativeThread instead of using the C++ threads as we do for apple and mingw. Question is how to detect the situation and do it properly.