Stockfish: Clang-windows builds

Created on 9 Jan 2018  路  4Comments  路  Source: official-stockfish/Stockfish

Native Clang 5 for Windows (not mingw/msys/cygwin) using msvc libraries if its installed.
Such clang will produce a "static" binary as well.
Consequently we need "-Xclang -flto-visibility-public-std" CXXFLAGS into Makefile for successfully compilation.
Moreover we need to remove -latomic and -lpthread from LDFLAGS.
That is not all :))
If you have modern includes from Visual Studio 2017 for example, we need to replace -std=c++11 with -std=c++14 which is logical.
In this case we will see characteristic warnings such as:

In file included from benchmark.cpp:26:
In file included from ./position.h:29:
In file included from ./bitboard.h:26:
./types.h:64:11: warning: 'IS_64BIT' macro redefined [-Wmacro-redefined]

define IS_64BIT

      ^

:2:9: note: previous definition is here

define IS_64BIT 1

    ^

1 warning generated.

As for mingw/msys/cygwin for -static LDFLAGS, we need CXXFLAGS="-Xclang -flto-visibility-public-std" too.

Unfortunately "profile-build" doesn't work for clang on windows. We can use just "build" only.

Would you like to do changes for Makefile with my suggestions? :)))

Most helpful comment

Changing C++11 to C++14 can be done only after SF9 is out because it is a big change and will make many compilers obsolete, so it is really not something you want to do now.

All 4 comments

Can you make the changes and turn this into a pull request?

@mstembera
No, I can't

Changing C++11 to C++14 can be done only after SF9 is out because it is a big change and will make many compilers obsolete, so it is really not something you want to do now.

Let's reopen this one after we have decided to switch to C++14

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GBeauregard picture GBeauregard  路  7Comments

anonymous7002 picture anonymous7002  路  3Comments

ZagButNoZig picture ZagButNoZig  路  6Comments

NightlyKing picture NightlyKing  路  7Comments

BKSpurgeon picture BKSpurgeon  路  6Comments