LTO setup

Fabio Coatti fabio.coatti@gmail.com
Thu Feb 4 10:46:00 GMT 2016


In data mercoledì 3 febbraio 2016 15:58:52, Markus Trippelsdorf ha scritto:
> On 2016.02.03 at 15:28 +0100, Fabio Coatti wrote:

> > If I grep strings for a symbols shown by nm, like this:
> > # nm /usr/lib/libplibfnt.a | grep ZN7fntFontC2Ev
> > 00000000 T _ZN7fntFontC2Ev
> > 
> >          U _ZN7fntFontC2Ev
> > 
> > I get the following result:
> > # strings /usr/lib/libplibfnt.a | grep ZN7fntFontC2Ev
> > _ZN7fntFontC2Ev
> > .gnu.lto__ZN7fntFontC2Ev.73e0594a6663c7f3
> > 
> > while doing the same for asymbol not shown by nm:
> > strings /usr/lib/libplibfnt.a | grep ZL23Fixed8x13_Character_12
> > 
> > I get the following output (for a lto-built lib)
> > # strings /usr/lib/libplibfnt.a | grep ZL23Fixed8x13_Character_123
> > .gnu.lto__ZL23Fixed8x13_Character_123.78e9fac11ab52f79
> > 
> > Quite different, as it is shown only as .gnu.lto
> > 
> > does this means that the lib itself is built correctly with lto flag, and
> > it is a problem in the build phase of the program requiring the static
> > lib? If this is the case, the behaviour of nm, not showng .lto symbols is
> > it correct?
> Local read only data sections are normally not shown for -flto build
> archives.
> 
> But it should normally all work just fine. What is the exact error you
> get when you use libplibfnt.a (build with -flto) later on?

The errors are reported below; those error disappears if plib is compiled 
without lto. 

Maybe (just guessing): is it possible that compiling flightgear (I use this as 
example, but similar issues happens with other packages linking to static libs 
as well) with lto is not possible due to some package internal reasons, so I 
need to turn off lto for it. But doing so and having the static lib compiled 
with lto the linker is not able to find the right symbols.
If the above is correct, a solution can be to compile the static lib with -
ffat-lto-objects, besides fixing the package itself or waiting for gcc to be 
able to cope with it?

Thanks again for the info.

/usr/lib64/qt5/bin/moc -I/var/tmp/portage/games-
simulation/flightgear-3.4.0/work/flightgear-3.4.0/3rdparty/iaxclient/lib -
I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/AL -
I/usr/include/simgear/3rdparty/utf8 -I/var/tmp/portage/games-
simulation/flightgear-3.4.0/work/flightgear-3.4.0 -I/var/tmp/portage/games-
simulation/flightgear-3.4.0/work/flightgear-3.4.0/src -I/var/tmp/portage/games-
simulation/flightgear-3.4.0/work/flightgear-3.4.0_build/src -
I/var/tmp/portage/games-
simulation/flightgear-3.4.0/work/flightgear-3.4.0_build/src/Include -
I/var/tmp/portage/games-
simulation/flightgear-3.4.0/work/flightgear-3.4.0_build/src/GUI -
I/usr/include/qt5 -I/usr/include/qt5/QtCore -I/usr/lib64/qt5/mkspecs/linux-g++ 
-I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include -
I/usr/include -DHAVE_CONFIG_H -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -
DQT_WIDGETS_LIB -DWITH_EVENTINPUT -o /var/tmp/portage/games-
simulation/flightgear-3.4.0/work/flightgear-3.4.0_build/src/GUI/moc_QtLauncher.cpp 
/var/tmp/portage/games-
simulation/flightgear-3.4.0/work/flightgear-3.4.0/src/GUI/QtLauncher.hxx 
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans4.ltrans.o: In function 
`FGFontCache::initializeFonts()':
<artificial>:(.text+0xbd5): undefined reference to `ulOpenDir(char const*)'
<artificial>:(.text+0xc2e): undefined reference to `ulReadDir(_ulDir*)'
<artificial>:(.text+0xd0c): undefined reference to `fntFont::fntFont()'
<artificial>:(.text+0xd1e): undefined reference to `vtable for fntTexFont'
<artificial>:(.text+0xd60): undefined reference to `fntTexFont::load(char 
const*, unsigned int, unsigned int)'
<artificial>:(.text+0xd81): undefined reference to `vtable for fntTexFont'
<artificial>:(.text+0xd9b): undefined reference to `fntFont::~fntFont()'
<artificial>:(.text+0xf86): undefined reference to `ulCloseDir(_ulDir*)'
<artificial>:(.text+0x10d2): undefined reference to `fntFont::~fntFont()'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans9.ltrans.o: In function 
`FGFontCache::getfnt(char const*, float, float)':
<artificial>:(.text+0x789): undefined reference to `puFont::puFont()'
<artificial>:(.text+0xa48): undefined reference to `PUFONT_HELVETICA_12'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans9.ltrans.o:(.rodata+0x8): 
undefined reference to `PUFONT_HELVETICA_12'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans9.ltrans.o:(.rodata+0x18): 
undefined reference to `PUFONT_8_BY_13'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans9.ltrans.o:(.rodata+0x28): 
undefined reference to `PUFONT_9_BY_15'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans9.ltrans.o:(.rodata+0x38): 
undefined reference to `PUFONT_TIMES_ROMAN_10'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans9.ltrans.o:(.rodata+0x48): 
undefined reference to `PUFONT_TIMES_ROMAN_24'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans9.ltrans.o:(.rodata+0x58): 
undefined reference to `PUFONT_HELVETICA_10'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans9.ltrans.o:(.rodata+0x68): 
undefined reference to `PUFONT_HELVETICA_12'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans9.ltrans.o:(.rodata+0x78): 
undefined reference to `PUFONT_HELVETICA_18'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans10.ltrans.o: In function 
`fntTexFont::~fntTexFont()':
<artificial>:(.text+0x9f): undefined reference to `vtable for fntTexFont'
<artificial>:(.text+0xb9): undefined reference to `fntFont::~fntFont()'
<artificial>:(.text+0xd5): undefined reference to `fntFont::~fntFont()'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans10.ltrans.o: In function 
`FGFontCache::fnt::~fnt()':
<artificial>:(.text+0x456): undefined reference to `vtable for fntTexFont'
<artificial>:(.text+0x470): undefined reference to `fntFont::~fntFont()'
<artificial>:(.text+0x4b1): undefined reference to `fntFont::~fntFont()'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans10.ltrans.o: In function 
`fntTexFont::~fntTexFont()':
<artificial>:(.text+0x4cf): undefined reference to `vtable for fntTexFont'
<artificial>:(.text+0x4fd): undefined reference to `fntFont::~fntFont()'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans10.ltrans.o: In function 
`fntTexFont::putch(float*, float, float, char)':
<artificial>:(.text+0x14a): undefined reference to `fntTexFont::low_putch(float*, 
float, float, char)'
/var/tmp/portage/games-
simulation/flightgear-3.4.0/temp/ccdyfyT5.ltrans10.ltrans.o: In function 
`fntTexFont::~fntTexFont()':
<artificial>:(.text+0x4ef): undefined reference to `fntFont::~fntFont()'
collect2: error: ld returned 1 exit status
utils/fgpanel/CMakeFiles/fgpanel.dir/build.make:319: recipe for target 
'utils/fgpanel/fgpanel' failed
make[2]: *** [utils/fgpanel/fgpanel] Error 1
make[2]: Leaving directory '/var/tmp/portage/games-
simulation/flightgear-3.4.0/work/flightgear-3.4.0_build'
CMakeFiles/Makefile2:435: recipe for target 
'utils/fgpanel/CMakeFiles/fgpanel.dir/all' failed
make[1]: *** [utils/fgpanel/CMakeFiles/fgpanel.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....


-- 
Fabio



More information about the Gcc-help mailing list