-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LTO on windows #2769
Comments
Maybe we should revert the MinGW part of 11483fe until we find something better. |
If I may, I find it a little bit agressive that you give me orders, use sentences with exclamation marks, etc, because you feel that I don't review your makefile fast enough :-) This is a part-time hobby, don't forget. |
new makefile works perfectly with lto in windows with mingw, maybe you need to update your mingw |
this needs an update with the version of gcc used, and the precise error message seen. |
was also reported on fishcooking: |
@snicolet I apologize, I admitted you are correct I really forget: This is our part-time hobby. This's extremely so weird, updated to the latest:
and make option
old one
|
I would first like us to understand this, before making new changes in a rush. |
@abdulbadii What happened to your LDFLAGS? Did you modify the makefile?
|
gcc command output
|
here it is gcc version 6.1.0 gcc.exe (x86_64-posix-seh, Built by MinGW-W64 project) 6.1.0 builds which works with old master latest build fails Flags: with the latest makefile, and removing > /dev/null make[2]: Leaving directory Step 2/4. Running benchmark for pgo-build ... my install came from the fishtest portable exe. I installed this in January 2020 |
OK, thanks for the info. So gcc 6 doesn't work seemingly. https://www.gnu.org/software/gcc/gcc-6/ says it is no longer supported (was first released in 2016). However, I can see an issue if that is what is part of our fishtest portable exe. @ppigazzini do you have a suggestion/idea here? LTO is a rather important optimization, a quick check here suggests it is currently about 7% speedup. |
here is some ideas to test the gcc version in a makefile |
To be honest, I would rather see how we can drop supporting old compiler versions. If even the team developing it stops supporting it, why should we support it? Of course, it would mean that some devs have to upgrade, which is unfortunate, but as the 7% shows, has a benefit as well. |
@vondele I already built and tested a new windows-portable archive with gcc 8.x and python3. I need a host where upload the archive and get a link to be used in a bat script (GDrive is out). Unfortunately Gary isn't the owner of the S3 bucket where is stored the original window-portable archive :( |
@ppigazzini options that would come to mind would be to
I somehow prefer the first, we're presumably talking about a handful of downloads a week, the server should have no problem with that... but maybe I overlooked something? |
FYI I can also confirm that the addition of -flto to the mingw compile does break
on Windows using mingw and gcc 8.1.0 |
Is there a solution to this? |
@FauziAkram if you only need a bench number,
|
I’m not sure what we gained by fixing something that was not broken , and it’s now broken. My mingw is updated. I just reverted the makefile - but flto was working fine for me prior to the patch. |
@FauziAkram another workaround without changing the sources is to add So far, to me it is not yet clear what is working, what is broken. I'm not on windows so can not really test. |
@MichaelB7 if LTO was working fine before the patch, can you specify how your make command looked like, and can you paste/attach the build output ? |
@vondele I got only now the time to read the thread, sorry. LTO on windows should work only with dynamic link and copying the dlls alongside the binary, see the wiki page |
Think wiki is outdated. I build static version with lto (see above log). |
The mingw based toolchain is really fragile. I tried to cross-compile a pgo build (following the wiki procedure), which worked on ubuntu 18, but now fails on ubuntu 20 (both before and after the Makefile change). |
@ppigazzini The -flto issue has been known for a long time. Given your success I suspect the mingw toolchain got fixed at some point between gcc 8.1 and 10.1. |
In effect Stockfish LTO static is fine with gcc version 10.1.0 by MSYS2 and gcc version 9.2 by TDM-GCC , but still broken with gcc 8.1.0 by MinGW-w64. |
this AM - all seems well - no errors
|
@vondele it works also with gcc 9.2 by TDM-GCC, but it's broken with gcc 8.1.0 by MinGW-w64 (and older). |
@ppigazzini but TDM-GCC is not default either, right. So for the makefile the following comment would be right
or can you formulate it more precisely. |
I have absolutely zero experience in these things, however, I just checked. |
Simply install msys2, read the wiki. Build Stockfish Run the worker on Windows |
@ppigazzini can you get the PGO cross compile to work on ubuntu 20.04 LTS ? I have it fail:
This is new on ubuntu 20.04 for me. |
@vondele there is not a MinGW-w64 default on Windows. I personally like the msys2 project because is actively developed and has many packages (even QT static to build cutechess-cli), so during the years I rewrote the wiki pages in order to use msys2 as first choice. TDM-GCC is an alternative project (run by one person) that at the moment provide gcc 9.2 |
I'll try tonight. |
LTO with static linking is still only working with the latest versions of gcc, causing problems for some devs. fixes official-stockfish#2769 No functional change.
I've made the pull request for the revert, maybe somebody can test this works as expected on Windows. |
@vondele I confirm the Makefile from the new PR now works for me. Thanks! |
@vondele on Ubuntu 20.04 (MinGW-w64 gcc) PGO fails, same problem some years ago (the slow windows Abrok compiles ...). |
FYI it's possible to check the gcc/mingw version in the makefile. |
@vondele I have the same issue as you (on Ubuntu 20.04) . Any idea on how to solve this? :) |
@firetea install gcc 10 |
@MichaelB7 Thanks, but I try to compile using mingw-w64 and I think the latest version there is is 9.3. If I have misunderstood something then please correct me :) |
@firetea no I haven't been able to solve this, this was filed as a bug in ubuntu: |
@vondele Thanks, I tried it using 7.3 and it worked. |
@firetea, do you mind sharing how you installed mingw 7.3 ? |
@vondele consider to use LXD/LXC, it's already installed on Ubuntu 20.04
|
@vondele I considered editing /etc/apt/sources.list to add "bionic main" or similar and do an apt-get update, but in the end I went for the dirty solution to download the deb-packages from https://packages.ubuntu.com/bionic/devel/gcc-mingw-w64, i.e I downloaded |
@ppigazzini that works... I've added the 'stuff in the container' explicitly below.
|
@vondele |
@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. |
@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. |
@vondele @firetea I done a clean install on Hyper-V with latest Ubuntu 20.04 ISOs
Use |
@snicolet please watch the latest update makefile!
and watch the first author's comment and what one has warned: #2731 (comment)
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:
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 executionIt only compiles without echoing any error
The text was updated successfully, but these errors were encountered: