I'm trying to compile Stockfish, using mingw compiler (gcc version 4.5.2).
If I use dynamic linking of the pthread library all goes fine, but when I try to static link I go into troubles.
After some trial and fail, I've managed to get the code to compile, but as soon as I launch the executable, it crashes with a segfault.
Here is the compiler log:
Code: Select all
-------------- Clean: Debug_static in stockfish_201_skill ---------------
Cleaned "stockfish_201_skill - Debug_static"
-------------- Build: Debug_static in stockfish_201_skill ---------------
[ 4.5%] mingw32-g++.exe -Wall -g -Wall -Wcast-qual -fno-exceptions -fno-rtti -Wno-long-long -Wextra -msse -DSKILL_LEVELS -DPTW32_STATIC_LIB -Wall -c F:\PortableApps\PortableApps\chess\stockfish\stockfish_skill_201\benchmark.cpp -o obj_static_debug\benchmark.o
...
...
[ 95.5%] mingw32-g++.exe -Wall -g -Wall -Wcast-qual -fno-exceptions -fno-rtti -Wno-long-long -Wextra -msse -DSKILL_LEVELS -DPTW32_STATIC_LIB -Wall -c F:\PortableApps\PortableApps\chess\stockfish\stockfish_skill_201\ucioption.cpp -o obj_static_debug\ucioption.o
[100.0%] mingw32-g++.exe -o bin_static_debug\stockfish_skill.exe obj_static_debug\benchmark.o obj_static_debug\bitbase.o obj_static_debug\bitboard.o obj_static_debug\book.o obj_static_debug\endgame.o obj_static_debug\evaluate.o obj_static_debug\history.o obj_static_debug\main.o obj_static_debug\material.o obj_static_debug\misc.o obj_static_debug\move.o obj_static_debug\movegen.o obj_static_debug\movepick.o obj_static_debug\pawns.o obj_static_debug\position.o obj_static_debug\san.o obj_static_debug\search.o obj_static_debug\timeman.o obj_static_debug\tt.o obj_static_debug\uci.o obj_static_debug\ucioption.o -static-libgcc -static-libstdc++ -lpthreadGC2 -lsupc++ -lws2_32
Output size is 3.04 MB
Process terminated with status 0 (0 minutes, 48 seconds)
0 errors, 0 warnings (0 minutes, 48 seconds)
Code: Select all
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug_static
Adding source dir: F:\PortableApps\PortableApps\chess\stockfish\stockfish_skill_201\stockfish_skill\
Adding source dir: F:\PortableApps\PortableApps\chess\stockfish\stockfish_skill_201\
Adding file: bin_static_debug\stockfish_skill.exe
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.2
Child process PID: 948
Program received signal SIGSEGV, Segmentation fault.
In ntdll!RtlpWaitForCriticalSection () (C:\WINDOWS\system32\ntdll.dll)
At F:\PortableApps\PortableApps\chess\stockfish\stockfish_skill_201\search.cpp:2350
Code: Select all
#0 7C92B21A ntdll!RtlpWaitForCriticalSection() (C:\WINDOWS\system32\ntdll.dll:??)
#1 7C911046 ntdll!RtlEnumerateGenericTableLikeADirectory() (C:\WINDOWS\system32\ntdll.dll:??)
#2 00000000 0x00e9e7c8 in ptw32_thread_reuse_lock() (??:??)
#3 00000000 0x0043d190 in pthread_cond_init() (??:??)
#4 0042E517 (anonymous namespace)::ThreadsManager::init_threads(this=0x5d2720) (F:\PortableApps\PortableApps\chess\stockfish\stockfish_skill_201\search.cpp:2350)
#5 0042A08E init_threads() (F:\PortableApps\PortableApps\chess\stockfish\stockfish_skill_201\search.cpp:356)
#6 0041387A main(argc=1, argv=0x3e25c0) (F:\PortableApps\PortableApps\chess\stockfish\stockfish_skill_201\main.cpp:69)
Thanks and cheers,
- Giorgio
