Closed d3vv closed 5 years ago
Please try to edit misc.cpp addingthe below line;
extern "C" {
struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; // Add this line!!!
typedef bool(*fun1_t)(LOGICAL_PROCESSOR_RELATIONSHIP,
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD);
@mcostalba
g++ -Wall -Wcast-qual -fno-exceptions -std=c++11 -pedantic -Wextra -Wshadow -m3
2 -DNDEBUG -O3 -msse -flto -c -o misc.o misc.cpp
misc.cpp:38:23: error: typedef 'fun1_t' is initialized (use decltype instead)
typedef bool(*fun1_t)(LOGICAL_PROCESSOR_RELATIONSHIP,
^
misc.cpp:38:23: error: 'LOGICAL_PROCESSOR_RELATIONSHIP' was not declared in this
scope
misc.cpp:39:23: error: 'PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX' was not declar
ed in this scope
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD);
^
misc.cpp:39:71: error: expected primary-expression before ')' token
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD);
^
misc.cpp:40:31: error: 'PGROUP_AFFINITY' has not been declared
typedef bool(*fun2_t)(USHORT, PGROUP_AFFINITY);
^
misc.cpp:41:37: error: 'GROUP_AFFINITY' does not name a type
typedef bool(*fun3_t)(HANDLE, CONST GROUP_AFFINITY*, PGROUP_AFFINITY);
^
misc.cpp:41:54: error: 'PGROUP_AFFINITY' has not been declared
typedef bool(*fun3_t)(HANDLE, CONST GROUP_AFFINITY*, PGROUP_AFFINITY);
^
misc.cpp: In function 'int WinProcGroup::best_group(size_t)':
misc.cpp:242:16: error: 'fun1_t' was not declared in this scope
auto fun1 = (fun1_t)(void(*)())GetProcAddress(k32, "GetLogicalProcessorInform
ationEx");
^
misc.cpp:242:24: error: expected primary-expression before 'void'
auto fun1 = (fun1_t)(void(*)())GetProcAddress(k32, "GetLogicalProcessorInform
ationEx");
^
misc.cpp:247:12: error: 'RelationAll' was not declared in this scope
if (fun1(RelationAll, nullptr, &returnLength))
^
misc.cpp:255:13: error: 'RelationAll' was not declared in this scope
if (!fun1(RelationAll, buffer, &returnLength))
^
misc.cpp:263:14: error: invalid use of incomplete type 'struct SYSTEM_LOGICAL_PR
OCESSOR_INFORMATION_EX'
if (ptr->Relationship == RelationNumaNode)
^
misc.cpp:37:9: note: forward declaration of 'struct SYSTEM_LOGICAL_PROCESSOR_INF
ORMATION_EX'
struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; // Add this line!!!
^
misc.cpp:263:32: error: 'RelationNumaNode' was not declared in this scope
if (ptr->Relationship == RelationNumaNode)
^
misc.cpp:266:19: error: invalid use of incomplete type 'struct SYSTEM_LOGICAL_PR
OCESSOR_INFORMATION_EX'
else if (ptr->Relationship == RelationProcessorCore)
^
misc.cpp:37:9: note: forward declaration of 'struct SYSTEM_LOGICAL_PROCESSOR_INF
ORMATION_EX'
struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; // Add this line!!!
^
misc.cpp:266:37: error: 'RelationProcessorCore' was not declared in this scope
else if (ptr->Relationship == RelationProcessorCore)
^
misc.cpp:269:26: error: invalid use of incomplete type 'struct SYSTEM_LOGICAL_PR
OCESSOR_INFORMATION_EX'
threads += (ptr->Processor.Flags == LTP_PC_SMT) ? 2 : 1;
^
misc.cpp:37:9: note: forward declaration of 'struct SYSTEM_LOGICAL_PROCESSOR_INF
ORMATION_EX'
struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; // Add this line!!!
^
misc.cpp:269:47: error: 'LTP_PC_SMT' was not declared in this scope
threads += (ptr->Processor.Flags == LTP_PC_SMT) ? 2 : 1;
^
misc.cpp:273:24: error: invalid use of incomplete type 'struct SYSTEM_LOGICAL_PR
OCESSOR_INFORMATION_EX'
byteOffset += ptr->Size;
^
misc.cpp:37:9: note: forward declaration of 'struct SYSTEM_LOGICAL_PROCESSOR_INF
ORMATION_EX'
struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; // Add this line!!!
^
misc.cpp:274:74: error: invalid use of incomplete type 'struct SYSTEM_LOGICAL_PR
OCESSOR_INFORMATION_EX'
ptr = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)(((char*)ptr) + ptr->Size
);
^
misc.cpp:37:9: note: forward declaration of 'struct SYSTEM_LOGICAL_PROCESSOR_INF
ORMATION_EX'
struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; // Add this line!!!
^
misc.cpp:241:11: warning: unused variable 'k32' [-Wunused-variable]
HMODULE k32 = GetModuleHandle("Kernel32.dll");
^
misc.cpp: In function 'void WinProcGroup::bindThisThread(size_t)':
misc.cpp:317:3: error: 'GROUP_AFFINITY' was not declared in this scope
GROUP_AFFINITY affinity;
^
misc.cpp:318:20: error: 'affinity' was not declared in this scope
if (fun2(group, &affinity))
^
make[1]: *** [misc.o] Error 1
make[1]: Leaving directory `/home/dew/Stockfish-master/src'
make: *** [build] Error 2
I have find out that my compiler has no LOGICAL_PROCESSOR_RELATIONSHIP declaration into winnt.h which assumed is used from windows.h by Stockfish developers.. I don't know if it is serious fault of compiler cause it can produce code for any win32 system since windows 95, ReactOS and etc.. In any cases we can understand now that minimal requirements for Stockfish it is:
Windows Vista, Windows XP Professional x64 Edition [desktop apps only] Windows Server 2003 [desktop apps only]
as described by document below:
https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ne-winnt-_logical_processor_relationship