Closed d3vv closed 4 years ago
The message about std:: clamp
conflicting with our home made clamp
tells me that you are trying to compile with C++17. (std:;clamp is part of the STL since C++17)
Stockfish had not yet been ported to C++17.
To fix this you can simply comment, in bitboard.h the following lines
//template
and wherever you see clamp, replace with std::clamp (or compile with c++14 or c++11)
For the other error messages, they are similar to the following issue encountered in the famous julia project https://github.com/JuliaLang/julia/issues/24952 Their conclusion was that "we do not support intel compiler"
However it seems that some effort was done in the past to support Intel in SF code.
for example line 69 of timeman.cpp shows the following
return TimePoint(myTime * std::min(ratio1, ratio2)); // Intel C++ asks for an explicit cast
I think that if you remove the constexpr before
constexpr Score MobilityBonus[][32] = {
constexpr Score Bonus[][RANK_NB][int(FILE_NB) / 2] = {
constexpr Score PBonus[RANK_NB][FILE_NB] =
it will compile correctly, although with some warnings.
@Rocky640 You are right at all.
There is was no problem to compile SF via Intel Compiler time ago.
Now I can't choose C++11 at Visual Studio 2019 IDE (only C++14, 17 and Latest C++ Draft Standard)
But constexpr
-errors persist also if I choose C++14 with IDE or C++11 with Command Line Tools.
This is from most stronger standard for constexpr
.
As about home made clamp
- it is strange to use "using namespace std;
" in any cases..
And don't use something like "custom::clamp
"..
And more about effort to support Intel in SF code:
$ grep INTEL *
bitboard.h:#elif defined(_MSC_VER) || defined(__INTEL_COMPILER)
misc.cpp:# if defined(__INTEL_COMPILER)
misc.cpp:# if defined(__INTEL_COMPILER) || defined(_MSC_VER)
types.h:/// __INTEL_COMPILER Compiler is Intel
types.h:#if defined(USE_POPCNT) && (defined(__INTEL_COMPILER) || defined(_MSC_VER))
types.h:#if !defined(NO_PREFETCH) && (defined(__INTEL_COMPILER) || defined(_MSC_VER))
Could the constexpr errors be due to the c-style casts? Perhaps c-style casts aren't constexpr in modern intel compilers? I can't test this myself unfortunately.
@gvreuls I will try to investigate all a bit later.. Just I'm under pressure and the rest needed But! Thousands C-style casts into the code it is sadly.. Nobody knows what is it - static, dynamic, reinterpret, const or void into the mind..
And at first glance it is very strange to use the voids into constexpr
like laconic { },
Cause constexpr
has real cruel limitations into c++11 and a bit softly into latest standards..
@andrey-budko Could u suggest thoughts about ur godbolt-link above? По-руcски: Ваши соображения по поводу анализа этого кода?
Not an issue until we switch to C++17