Description of problem: When building the `godot` package on Fedora 32 and Rawhide (both using GCC 10.0.1), the linking fails (with LTO enabled) with errors related to "undefined reference to `vtable for ClassName' ". The same spec file builds fine with LTO on Fedora 30 and 31, EPEL8, and Mageia 7 (GCC 8.4.0, binutils 2.33.1) and 8 (GCC 9.3.0.RC1, binutils 2.34). Package source: https://src.fedoraproject.org/rpms/godot Failed builds: https://koji.fedoraproject.org/koji/taskinfo?taskID=42402454 https://koji.fedoraproject.org/koji/taskinfo?taskID=42402448 Upstream report: https://github.com/godotengine/godot/issues/36984 We haven't established yet whether it's an issue with GCC 10 itself, or a Fedora 32+ flag, and if it's something that we can fix in the Godot codebase directly. But LTO has been used on that codebase for the past two years with previous versions of GCC, Clang and MSVC without major hurdles. Link error: ``` scons-3 -j6 'CCFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' 'LINKFLAGS=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' builtin_freetype=no builtin_libogg=no builtin_libpng=no builtin_libtheora=no builtin_libvorbis=no builtin_libvpx=no builtin_libwebp=no builtin_mbedtls=no builtin_opus=no builtin_pcre2=no builtin_zlib=no builtin_zstd=no builtin_miniupnpc=no use_lto=yes udev=yes progress=no p=x11 tools=yes target=release_debug ... Linking Static Library ==> core/libcore.x11.opt.tools.64.a Ranlib Library ==> modules/libmodules.x11.opt.tools.64.a core/variant_call.cpp: In function 'register_variant_methods': core/variant_call.cpp:1485:6: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without 1485 | void register_variant_methods() { | ^ Ranlib Library ==> servers/libservers.x11.opt.tools.64.a Ranlib Library ==> core/libcore.x11.opt.tools.64.a core/variant_call.cpp: In function 'register_variant_methods': core/variant_call.cpp:1485:6: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without 1485 | void register_variant_methods() { | ^ editor/plugins/visual_shader_editor_plugin.cpp: In member function '__ct_base ': editor/plugins/visual_shader_editor_plugin.cpp:2280:1: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without 2280 | VisualShaderEditor::VisualShaderEditor() { | ^ Ranlib Library ==> editor/libeditor.x11.opt.tools.64.a Ranlib Library ==> scene/libscene.x11.opt.tools.64.a editor/plugins/visual_shader_editor_plugin.cpp: In member function '__ct_base ': editor/plugins/visual_shader_editor_plugin.cpp:2280:1: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without 2280 | VisualShaderEditor::VisualShaderEditor() { | ^ Linking Program ==> bin/godot.x11.opt.tools.64 servers/visual_server.cpp: In function '_bind_methods': servers/visual_server.cpp:1639: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without 1639 | void VisualServer::_bind_methods() { | editor/editor_node.cpp: In member function '__ct_base ': editor/editor_node.cpp:5579: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without 5579 | EditorNode::EditorNode() { | /bin/ld: /tmp/godot.x11.opt.tools.64.rEQkSf.ltrans37.ltrans.o: in function `EditorNode::EditorNode()': /builddir/build/BUILD/godot-3.2.1-stable/./editor/plugins/root_motion_editor_plugin.h:62: undefined reference to `vtable for EditorInspectorRootMotionPlugin' /bin/ld: /tmp/godot.x11.opt.tools.64.rEQkSf.ltrans51.ltrans.o: in function `AnimationPlayerEditor::AnimationPlayerEditor(EditorNode*, AnimationPlayerEditorPlugin*)': /builddir/build/BUILD/godot-3.2.1-stable/editor/animation_track_editor_plugins.h:165: undefined reference to `vtable for AnimationTrackEditDefaultPlugin' collect2: error: ld returned 1 exit status scons: *** [bin/godot.x11.opt.tools.64] Error 1 scons: building terminated because of errors. ``` How reproducible: 100% in my tests, but user in upstream report mentions that it *might* succeed in some cases, randomly. Steps to Reproduce: 1. Build https://src.fedoraproject.org/rpms/godot on Fedora 32 or Rawhide or 1. Clone https://github.com/godotengine/godot/ and checkout `3.2` branch 2. Install build deps (from spec file or docs: ) 3. Run `scons p=x11 tools=yes target=release_debug use_lto=yes -j6 verbose=yes`
CC Jakub as I believe this might be linked to GCC 10, though it's too early for me to confirm it and make this a GCC bug report.
Note: I don't know how reproducible this is now due to another bug with `-flto=n`: bug 1823349.
https://github.com/godotengine/godot/issues/36984 seems to be the ticket for this in Godot's issue tracker.
Still reproducible in current F32, but builds fine in F33+. I'll consider this wontfix and won't update Godot in F32 (current still on 3.1.2).