Bug 1812783 - godot build with LTO using GCC 10.0.1 fails with "undefined reference to `vtable for ClassName' " (regression)
Summary: godot build with LTO using GCC 10.0.1 fails with "undefined reference to `vta...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: godot
Version: 32
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Rémi Verschelde
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1796167
TreeView+ depends on / blocked
 
Reported: 2020-03-12 07:24 UTC by Rémi Verschelde
Modified: 2021-02-14 13:17 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-02-14 13:17:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Rémi Verschelde 2020-03-12 07:24:59 UTC
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`

Comment 1 Rémi Verschelde 2020-03-12 07:27:46 UTC
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.

Comment 2 Rémi Verschelde 2020-04-13 12:31:22 UTC
Note: I don't know how reproducible this is now due to another bug with `-flto=n`: bug 1823349.

Comment 3 Martin Ellison 2020-06-14 05:42:26 UTC
https://github.com/godotengine/godot/issues/36984 seems to be the ticket for this in Godot's issue tracker.

Comment 4 Rémi Verschelde 2021-02-14 13:17:24 UTC
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).


Note You need to log in before you can comment on or make changes to this bug.