Skip to content
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

Enable -flto for mingw #2731

Closed
Morilli opened this issue Jun 11, 2020 · 10 comments
Closed

Enable -flto for mingw #2731

Morilli opened this issue Jun 11, 2020 · 10 comments

Comments

@Morilli
Copy link

Morilli commented Jun 11, 2020

I noticed that the makefile contains this suspicious line: Link Time Optimization, it works since gcc 4.5 but not on mingw under Windows.. As I have compiled numerous software with link-time optimization enabled, I can assure it does work on mingw. I have found this previous issue #392, which is almost 5 years old by now and must be outdated. I'd like for someone to confirm that -flto does work on windows with mingw so it can be enabled in the makefile.

@vondele
Copy link
Member

vondele commented Jun 11, 2020

This should really work, and I think the comment is an old left-over.
It is also what we advertise here:
https://github.com/glinscott/fishtest/wiki/Building-stockfish-on-Windows#build-stockfish
Just verify this works, for you, and let us know. We'll fix-up the comment later.

@Morilli
Copy link
Author

Morilli commented Jun 11, 2020

I have definitely tested it and it does work. I can launch the executable just fine and it's a little smaller than without -flto.

@vondele
Copy link
Member

vondele commented Jun 11, 2020

OK, I've removed the comment as part of #2695
Thanks for reporting.

@vondele vondele closed this as completed Jun 11, 2020
@Morilli
Copy link
Author

Morilli commented Jun 11, 2020

Shouldn't the actual code be adjusted as well? Because currently when using COMP=mingw -flto will not be set.

@vondele vondele reopened this Jun 11, 2020
@vondele
Copy link
Member

vondele commented Jun 11, 2020

Ah sorry, I understood that the code worked as if. Can you show the changes you made to the Makefile? (git diff)

@Morilli
Copy link
Author

Morilli commented Jun 11, 2020

Had actually just hacked that in before, but I think this should work:
mingw_diff.txt

edit: looking at it again, i'm not even sure the ifeq is even still necessary now, unless there is a 4th (or more?) supported options for COMP.

@abdulbadii
Copy link

abdulbadii commented Jun 22, 2020

@Morilli Why doesn't it works on my Mingw64 updated latest ?

@Morilli
Copy link
Author

Morilli commented Jun 22, 2020

Uhm I cannot tell why it doesn't work for you, both build and profile-build work with -flto for me.

@abdulbadii
Copy link

running abruptly breaks, only build succeeds

@unaiic
Copy link
Contributor

unaiic commented Jun 24, 2020

@Morilli Does it work now as it is in #2763?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants