I am getting several undefined references when compiling kdelibs 4.8.4 with gcc 4.7.1 (latest) and lto enabled (-flto and -Wl,-flto). I'll attach the full build log later, but these are the relevant lines (in linking stage when cmake reports 100% progress) /var/tmp/portage/kde-base/kdelibs-4.8.4/temp/cc5JUBsS.ltrans0.ltrans.o:cc5JUBsS.ltrans0.o:function _ZN5khtml8IDStringINS_13PrefixFactoryEED2Ev.local.62.3422: error: undefined reference to 'khtml::PrefixFactory::s_idTable' /var/tmp/portage/kde-base/kdelibs-4.8.4/temp/cc5JUBsS.ltrans0.ltrans.o:cc5JUBsS.ltrans0.o:function _ZN5khtml8IDStringINS_16NamespaceFactoryEED2Ev.local.64.3544: error: undefined reference to 'khtml::NamespaceFactory::s_idTable' /var/tmp/portage/kde-base/kdelibs-4.8.4/temp/cc5JUBsS.ltrans0.ltrans.o:cc5JUBsS.ltrans0.o:function _ZN5khtml8IDStringINS_13PrefixFactoryEED2Ev.local.62.3422: error: undefined reference to 'khtml::IDTableBase::releaseId(unsigned int)' /var/tmp/portage/kde-base/kdelibs-4.8.4/temp/cc5JUBsS.ltrans0.ltrans.o:cc5JUBsS.ltrans0.o:function _ZN5khtml8IDStringINS_16NamespaceFactoryEED2Ev.local.64.3544: error: undefined reference to 'khtml::IDTableBase::releaseId(unsigned int)' (seems all related to khtml) Reproducible: Always
Created attachment 72059 [details] Full build log Full build log for kdelibs-4.8.4 (problems are near the end of file)
Created attachment 72060 [details] Full build log Corrected attachment's myme type
My build fails at the same place. It should be noted that -fvisibility=hidden is also enabled. KDE_EXPORT on the Factories and releaseId() successfully keeps the compiler/linker from optimizing away these symbols. It could be argued that compiler is being overaggressive with the optimizations of the factories, but adding KDE_EXPORT shouldn't hurt anything. khtml::IDTableBase::releaseID(unsigned int) is private, so I can see how the compiler would think it is safe to optimize that out. There may be other symbols that weren't exported that need to be, but I haven't finished building kde, yet.
Created attachment 83933 [details] Patch to compile with lto Patch to be applied against 4.11.3
Try this patch to see if the kdelibs compiles with lto now. It works for me.
Dear Bug Submitter, This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond. Thank you for helping us make KDE software even better for everyone!
Dear Bug Submitter, This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? This bug will be moved back to REPORTED Status for manual review later, which may take a while. If you are able to, please lend us a hand. Thank you for helping us make KDE software even better for everyone!
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version? If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging If you have already provided the requested information, please mark the bug as REPORTED so that the KDE team knows that the bug is ready to be confirmed. Thank you for helping us make KDE software even better for everyone!
This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging Thank you for helping us make KDE software even better for everyone!