-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavioros-windows
Milestone
Description
Zig Version
0.9.1
Steps to Reproduce
# on linux
wget https://github.com/official-stockfish/Stockfish/archive/refs/heads/master.zip
unzip master
cd Stockfish-master/src
make build ARCH=x86-64 COMP=mingw CXX="zig c++ -target x86_64-windows-gnu"
Expected Behavior
Make a cross build with target Windows.
Notes:
- a mingw-w64 compiler on Windows (msys2, cygwin) or on Linux compiles/crosscompiles successfully that codebase
- zig compiles/crosscompiles sucessfully that codebase for other targets (eg
x86_64-linux-musl
,aarch64-linux-musl
)
Actual Behavior
In file included from evaluate.cpp:35:
In file included from ./thread.h:33:
./thread_win32_osx.h:32:10: fatal error: 'pthread.h' file not found
#include <pthread.h>
^~~~~~~~~~~
1 error generated.
make[1]: *** [<builtin>: evaluate.o] Error 1
The mingw-w64 shipped with Zig misses pthread.h
, I don't know if this is intended.
The wiki instructions to update mingw-w64 fail when configuring mingw-w64-crt
(and skips mingw-w64-winpthreads
) so I built mingw-w64 using this script: https://github.com/Zeranoe/mingw-w64-build
However after updating Zig with the new mingw-w64 headers I got errors/conflicts with some libcxx
files.
# zig update
zig_path=${HOME}/.zig/zig-linux-x86_64-0.9.1/lib/libc
mingw_path=${HOME}/.zeranoe/mingw-w64
cp -r ${mingw_path}/src/mingw-w64/mingw-w64-crt ${zig_path}/mingw
cp -r ${mingw_path}/x86_64/x86_64-w64-mingw32/include ${zig_path}/include/any-windows-any
cp ${mingw_path}/bld/x86_64/mingw-w64-crt/config.h ${zig_path}/include/any-windows-any/config.h
zig c++ -target x86_64-windows-gnu -o stockfish.exe 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_ka_v2_hm.o -static -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -save-temps
Compile C Objects [13/61] memmove_s.c... /home/usr00/.zig/zig-linux-x86_64-0.9.1/lib/libc/mingw/secapi/vsprintf_s.c:39:10: warning: implicit declaration of function '__ms_vsnprintf' is invalid in C99 [-Wimplicit-function-declaration]
return __ms_vsnprintf (_DstBuf, _Size, _Format, _ArgList);
^
1 warning generated.
Compile C Objects [94/408] vsnprintf.c... /home/usr00/.zig/zig-linux-x86_64-0.9.1/lib/libc/mingw/stdio/vwscanf.c:15:10: warning: implicit declaration of function '__ms_vfwscanf' is invalid in C99 [-Wimplicit-function-declaration]
return __ms_vfwscanf(stdin, format, arg);
^
1 warning generated.
Compile C Objects [12/44] stdexcept.cpp... /home/usr00/.zig/zig-linux-x86_64-0.9.1/lib/libcxx/src/support/win32/thread_win32.cpp:22:1: error: static_assert failed due to requirement 'sizeof(long long) == sizeof(_RTL_CRITICAL_SECTION)' ""
static_assert(sizeof(__libcpp_recursive_mutex_t) == sizeof(CRITICAL_SECTION),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/usr00/.zig/zig-linux-x86_64-0.9.1/lib/libcxx/src/support/win32/thread_win32.cpp:30:1: error: static_assert failed due to requirement 'sizeof(long) == sizeof(_RTL_RUN_ONCE)' ""
static_assert(sizeof(__libcpp_exec_once_flag) == sizeof(INIT_ONCE), "");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/usr00/.zig/zig-linux-x86_64-0.9.1/lib/libcxx/src/support/win32/thread_win32.cpp:31:1: error: static_assert failed due to requirement 'alignof(long) == alignof(_RTL_RUN_ONCE)' ""
static_assert(alignof(__libcpp_exec_once_flag) == alignof(INIT_ONCE), "");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
anacrolix, JerwuQu, thautwarm, ghishadow and hauserx
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavioros-windows