official-stockfish / Stockfish

A free and strong UCI chess engine
https://stockfishchess.org/
GNU General Public License v3.0
11.61k stars 2.28k forks source link

LTO on windows #2769

Closed abdulbadii closed 4 years ago

abdulbadii commented 4 years ago

@snicolet please watch the latest update makefile! and watch the first author's comment and what one has warned: https://github.com/official-stockfish/Stockfish/issues/2731#issuecomment-647805424 Link Time Optimization, it works since gcc 4.5 but not on mingw under Windows. that is his noble forewarn and correctly resolve it for us:

    ifneq (,$(filter $(comp),gcc clang))
        CXXFLAGS += -flto
        LDFLAGS += $(CXXFLAGS)

    else ifeq ($(comp),mingw)
        ifeq ($(KERNEL),Linux)
            CXXFLAGS += -flto
            LDFLAGS += $(CXXFLAGS)
        endif

below is it, it's on -flto and indeed it outright fails on Windows as author said and proved a failure on my Windows system execution

    ifeq ($(comp),$(filter $(comp),gcc clang mingw))
        CXXFLAGS += -flto
        LDFLAGS += $(CXXFLAGS)

It only compiles without echoing any error

ppigazzini commented 4 years ago

@vondele sudo lxc was required some years ago, with latest Ubuntu you can run even lxd init.

vondele commented 4 years ago

@ppigazzini strangely I had to install lxc/lxd and use sudo, despite being on 20.04, I might have carried over some old settings from a number of upgrades, however, a clean install of 20.04 might behave differently.

firetea commented 4 years ago

@vondele I tried it on a clean 20.04 (also had to Install lxd) but didnt need to use sudo for any of the commands though.

ppigazzini commented 4 years ago

@vondele @firetea I done a clean install on Hyper-V with latest Ubuntu 20.04 ISOs

Use sudo snap install lxd to have a recent lxc version.

https://ubuntu.com/blog/lxd-in-4-easy-steps