chore(build): stop compiling the unused flatc translation units - #258
Merged
Conversation
Both build paths fed four FlatBuffers sources - idl_parser.cpp, idl_gen_text.cpp, reflection.cpp and util.cpp - into the object list, but nothing references them. FlatBuffers is used header-only here: the generated format/*.h headers include flatbuffers/flatbuffers.h, and every symbol the player touches (Offset, Vector, FlatBufferBuilder, Table, Verifier, GetRoot) is inline. No source includes idl.h, reflection.h or util.h, and `nm -u` over all 18 built objects reports zero undefined flatbuffers symbols, so the linker never asked for any of it. Schema compilation is libssconverter's job on the Rust side; the flatc-side code is a leftover from when that was going to happen in C++. Drop the four sources from both SConstruct and SCsub, and drop flatbuffers/src from the include path - it was only there so those translation units could find their own private headers. That is ~757 KB of object code per target that is no longer built (idl_parser.o alone is 574 KB at -O2), on every platform and arch a release build covers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Both build paths compiled four FlatBuffers translation units that nothing in this project uses:
These are the flatc (schema compiler) side of FlatBuffers. Playback needs none of it — schema compilation is
libssconverter's job on the Rust side. They look like a leftover from when.sspj→.ssabconversion was going to happen in C++.FlatBuffers is used header-only here: the generated
format/*.hheaders includeflatbuffers/flatbuffers.h, whose reachable set (16 headers: buffer/table/vector/verifier/builder…) is entirely inline.Evidence that nothing linked against them:
idl.h,reflection.horutil.h— the only FlatBuffers include anywhere in the project isflatbuffers/flatbuffers.h, viaformat/*.h.Offset,Vector,FlatBufferBuilder,Table,Verifier,GetRoot,GetSizePrefixedRoot,BufferHasIdentifier,EndianScalar.nm -uover all 18 built objects (1:1 with the 18.cppfiles) reports zero undefinedflatbuffers::symbols. The linker never asked for anything these four files define.Changes
ss_player/sources.py— removeget_fb_sources(), replaced by a comment recording why FlatBuffers is header-only here. Also dropflatbuffers/srcfrom the include path; it was only needed so those translation units could find their own private headers (format/*.hresolves fine fromflatbuffers/includealone).ss_player/SCsub— remove theadd_source_filesloop (custom module).SConstruct— remove thesources_list.extend(...)call (GDExtension).Impact
~757 KB of object code per target is no longer built, on every platform/arch a release build covers:
idl_parser.oidl_gen_text.oreflection.outil.oStale objects from earlier builds confirmed this was being paid across 7 targets already (macOS editor, 3 Android ABIs, 3 iOS slices) — 28 objects, 5.0 MB.
No functional change.
Type of change
Build cleanup — none of the above categories apply.
Checklist:
Verification
Both build paths were built locally on macOS arm64:
GDExtension (
./scripts/build-extension.sh) — builds and links clean.Custom module (
./scripts/build.sh) —godot.macos.editor.arm64links successfully (2m32s).flatbuffers::symbols in the binary: 0, as expected for header-only, fully-inlined use.The
duplicate symbollink warnings (Rust runtime symbols shared betweenlibssruntime.aandlibssconverter.a) are pre-existing and identical before and after this change.