View previous topic :: View next topic |
Author |
Message |
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Thu Jan 05, 2012 5:20 pm Post subject: About the lto USE flag for GCC |
|
|
Trying to compile the Stockfish chess source code, it stop:
Code: | cc1plus: erreur: LTO support has not been enabled in this configuration. |
The Link Time Optimisations USE flag his disabled in default GCC configuration (-lto). Looking at
Code: | euse -I lto
global use flags (searching: lto)
************************************************************
no matching entries found
local use flags (searching: lto)
************************************************************
[- ] lto (sys-devel/gcc):
Add support for link-time optimizations (unsupported, use at your own risk). |
tell me 'unsupported, use at your own risk'. What are the risks justly to activate that flag? _________________ Paul |
|
Back to top |
|
|
Etal Veteran
Joined: 15 Jul 2005 Posts: 1931
|
Posted: Thu Jan 05, 2012 5:26 pm Post subject: |
|
|
I don't think simply activating will result in any risks. I think it means that if you enable the "lto" flag and then add "-flto" to your portage C/CXX/LDFLAGS, that's unsupported. _________________ “And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010 |
|
Back to top |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Thu Jan 05, 2012 6:42 pm Post subject: |
|
|
Thank's for your answer Etal. I see in the Makefile of Stockfish source code:
Code: | ### 3.11 Link Time Optimization, it works since gcc 4.5 but not on mingw.
### This is a mix of compile and link time options because the lto link phase
### needs access to the optimization flags.
ifeq ($(comp),gcc)
GCC_MAJOR := `gcc -dumpversion | cut -f1 -d.`
GCC_MINOR := `gcc -dumpversion | cut -f2 -d.`
ifeq (1,$(shell expr \( $(GCC_MAJOR) \> 4 \) \| \( $(GCC_MAJOR) \= 4 \& $(GCC_MINOR) \>= 5 \)))
CXXFLAGS += -flto
LDFLAGS += $(CXXFLAGS)
endif
endif |
So if I activate the GCC lto USE flag and recompile GCC, the Link Time Optimisations will be available at compilation time for LTO switchs in the Makefile or elsewhere in the source code, even if I do not activate those switchs anywhere. So, the GCC switchs who use LTO will be used not only here in Stockfish source code, but in any source code who use them. That will make my system use an unsupported USE flag that would not be use at all if not set.
Before to proceed, I want to know more about the consequences to set lto flag and make it available in the Makefile of Gentoo packages source code and others. |
|
Back to top |
|
|
Etal Veteran
Joined: 15 Jul 2005 Posts: 1931
|
Posted: Fri Jan 06, 2012 3:57 am Post subject: |
|
|
I don't think anything else will really use LTO by itself, and if they do, then it's up to the devs to support it or disable it, so I don't think just enabling the USE flag would be at all risky.
As an alternative, you can comment out the snippet you posted and your application should build fine without LTO, just as it would if you had an older version of gcc. _________________ “And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010 |
|
Back to top |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Sun Jan 08, 2012 9:58 am Post subject: |
|
|
I enable the lto USE flag for GCC, recompile it and then compile Stockfish. It work and no problem so far after emerge -aDNuv world. Thank's for your advises. _________________ Paul |
|
Back to top |
|
|
|