A question about compiling and running stockfish2.0.1

Discussion of chess software programming and technical issues.

Moderator: Ras

Uri Blass
Posts: 10887
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

A question about compiling and running stockfish2.0.1

Post by Uri Blass »

I tried to compile stockfish2.0.1
I added all the c and h files to the project.
I got no compilation errors but when I tried to run the program I got the following error.
The procedure entry point SleepConditionVariableSRW could not be located in the dynamic link library KERNEL32.dll
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: A question about compiling and running stockfish2.0.1

Post by mcostalba »

Uri Blass wrote:I tried to compile stockfish2.0.1
I added all the c and h files to the project.
I got no compilation errors but when I tried to run the program I got the following error.
The procedure entry point SleepConditionVariableSRW could not be located in the dynamic link library KERNEL32.dll
You probably are under Windows XP or older, in this case you should enable OLD_LOCKS, see types.h for a description.
User avatar
Eelco de Groot
Posts: 4669
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: A question about compiling and running stockfish2.0.1

Post by Eelco de Groot »

Uri Blass wrote:I tried to compile stockfish2.0.1
I added all the c and h files to the project.
I got no compilation errors but when I tried to run the program I got the following error.
The procedure entry point SleepConditionVariableSRW could not be located in the dynamic link library KERNEL32.dll
If you try to compile Stockfish 2.0.1 under Windows XP it is likely that the compiler won't accept some of the changed files, so I'm not sure if that is your operating system Uri?

I did the same as you, copied all the changed files to the 2.0 project in Visual Studio 2005 under Windows XP but then the compiler gives errors with the new threadlocks in lock.h. This is documented so it was reasonably clear I had to change this file a bit.

These were the compilation errors, my search.cpp and evaluate.cpp are slightly different so there the line numbers may not match those of Stockfish 2.0.1. It's a long list but basically it is a single error because the new code in lock.h is not accepted.
------ Rebuild All started: Project: Rainbow Serpent 2.0s(dc), Configuration: Release Win32 ------
Deleting intermediate and output files for project 'Rainbow Serpent 2.0s(dc)', configuration 'Release|Win32'
Compiling...
ucioption.cpp
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C2146: syntax error : missing ';' before identifier 'Lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C2146: syntax error : missing ';' before identifier 'WaitCondition'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C2146: syntax error : missing ';' before identifier 'lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\ucioption.cpp(69) : fatal error C1903: unable to recover from previous error(s); stopping compilation
uci.cpp
tt.cpp
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\tt.cpp(105) : warning C4244: 'initializing' : conversion from 'const Key' to 'uint32_t', possible loss of data
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\tt.cpp(140) : warning C4244: 'initializing' : conversion from 'const Key' to 'uint32_t', possible loss of data
timeman.cpp
search.cpp
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C2146: syntax error : missing ';' before identifier 'Lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C2146: syntax error : missing ';' before identifier 'WaitCondition'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C2146: syntax error : missing ';' before identifier 'lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(105) : error C2146: syntax error : missing ';' before identifier 'mpLock'
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(105) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(105) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(105) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(106) : error C2146: syntax error : missing ';' before identifier 'sleepCond'
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(106) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(106) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2190) : error C2065: 'sleepLock' : undeclared identifier
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2190) : error C3861: 'AcquireSRWLockExclusive': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2198) : error C3861: 'ReleaseSRWLockExclusive': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2204) : error C2065: 'sleepCond' : undeclared identifier
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2204) : error C3861: 'SleepConditionVariableSRW': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2206) : error C3861: 'ReleaseSRWLockExclusive': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2246) : error C2039: 'lock' : is not a member of 'SplitPoint'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(49) : see declaration of 'SplitPoint'
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2246) : error C3861: 'AcquireSRWLockExclusive': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2247) : error C2039: 'lock' : is not a member of 'SplitPoint'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(49) : see declaration of 'SplitPoint'
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2247) : error C3861: 'ReleaseSRWLockExclusive': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2270) : error C2065: 'mpLock' : undeclared identifier
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2270) : error C3861: 'InitializeSRWLock': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2274) : error C3861: 'InitializeSRWLock': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2275) : error C3861: 'InitializeConditionVariable': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2281) : error C2039: 'lock' : is not a member of 'SplitPoint'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(49) : see declaration of 'SplitPoint'
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2281) : error C3861: 'InitializeSRWLock': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2335) : error C2039: 'lock' : is not a member of 'SplitPoint'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(49) : see declaration of 'SplitPoint'
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2537) : error C3861: 'AcquireSRWLockExclusive': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2538) : error C3861: 'WakeConditionVariable': identifier not found
e:\Computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\search.cpp(2539) : error C3861: 'ReleaseSRWLockExclusive': identifier not found
san.cpp
position.cpp
pawns.cpp
movepick.cpp
movegen.cpp
move.cpp
misc.cpp
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C2146: syntax error : missing ';' before identifier 'Lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C2146: syntax error : missing ';' before identifier 'WaitCondition'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C2146: syntax error : missing ';' before identifier 'lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
material.cpp
main.cpp
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C2146: syntax error : missing ';' before identifier 'Lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C2146: syntax error : missing ';' before identifier 'WaitCondition'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C2146: syntax error : missing ';' before identifier 'lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
history.cpp
evaluate.cpp
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C2146: syntax error : missing ';' before identifier 'Lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C2146: syntax error : missing ';' before identifier 'WaitCondition'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C2146: syntax error : missing ';' before identifier 'lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
endgame.cpp
book.cpp
bitboard.cpp
bitbase.cpp
Compiling...
benchmark.cpp
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C2146: syntax error : missing ';' before identifier 'Lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C2146: syntax error : missing ';' before identifier 'WaitCondition'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\lock.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C2146: syntax error : missing ';' before identifier 'lock'
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\computerchess back-up\stockfish-20-ja\stockfish-20-ja\src\thread.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Build log was saved at "file://c:\Documents and Settings\E. de Groot\Mijn documenten\Visual Studio 2005\Projects\Rainbow Serpent 2.0s(dc)\Rainbow Serpent 2.0s(dc)\Release\BuildLog.htm"
Rainbow Serpent 2.0s(dc) - 82 error(s), 2 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I just added one line

Code: Select all

#define OLD_LOCKS
in the changed code of lock.h

Code: Select all

// Default fast and race free locks and condition variables
#define OLD_LOCKS
#if !defined(OLD_LOCKS)

typedef SRWLOCK Lock;
typedef CONDITION_VARIABLE WaitCondition;

#  define lock_init(x) InitializeSRWLock(x)
#  define lock_grab(x) AcquireSRWLockExclusive(x)
#  define lock_release(x) ReleaseSRWLockExclusive(x)
#  define lock_destroy(x) (x)
#  define cond_destroy(x) (x)
#  define cond_init(x) InitializeConditionVariable(x)
#  define cond_signal(x) WakeConditionVariable(x)
#  define cond_wait(x,y) SleepConditionVariableSRW(x, y, INFINITE,0)

// Fallback solution to build for Windows XP and older versions, note that
// cond_wait() is racy between lock_release() and WaitForSingleObject().
#else
and then Stockfish 2.0.1/Rainbow Serpent 2.0 compiled without errors again. I'm only testing with single threaded versions so I would not have benefitted from the new locks on this system, anyway I can't test them here.

Regards, Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
Uri Blass
Posts: 10887
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: A question about compiling and running stockfish2.0.1

Post by Uri Blass »

mcostalba wrote:
Uri Blass wrote:I tried to compile stockfish2.0.1
I added all the c and h files to the project.
I got no compilation errors but when I tried to run the program I got the following error.
The procedure entry point SleepConditionVariableSRW could not be located in the dynamic link library KERNEL32.dll
You probably are under Windows XP or older, in this case you should enable OLD_LOCKS, see types.h for a description.
Thanks
Adding
#define OLD_LOCKS in lock.h
solved the problem for me.