[Solved] Build failure with LTO (-Werror=odr)

I received a bug report[1] where building v7.6.2 fails when LTO is used. The issue is about the One Definition Rule of modern C++ standards:

FAILED: lin64/gcc/libi/libTKXCAF.so.7.6.2 
/var/tmp/portage/sci-libs/opencascade-7.6.2-r1/work/occt-V7_6_2/src/XCAFDoc/XCAFDoc_Datum.cxx:37:6: error: type ‘ChildLab’ violates the C++ One Definition Rule [-Werror=odr]

You can find a complete build log attached to the bug report on bugs.gentoo.org. If desired, I can upload the log file here as well.

Building with LTO is currently undergoing a systematic test review on Gentoo, so this issue is probably not new, but was just unrecognized as a warning, if people were already using LTO.

I can filter out such flags as a quick hack, but for the long term it would be more interesting what your plans are for LTO strictness of future releases.


[1] https://bugs.gentoo.org/862912

Kirill Gavrilov's picture

This is a forum, not bugtracker. If you would like your findings being considered in a roadmap - fill free to report a bug.