Skip to content

CMake: make MafiaHubServices an imported static target#207

Merged
Segfaultd merged 3 commits into
MafiaHub:developfrom
Kheartz:services-link-order
Jun 17, 2026
Merged

CMake: make MafiaHubServices an imported static target#207
Segfaultd merged 3 commits into
MafiaHub:developfrom
Kheartz:services-link-order

Conversation

@Kheartz

@Kheartz Kheartz commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Linking issue discovered when building HL mod on Linux CI:

MafiaHubServices (the prebuilt archive) contains references to Utils::Time, which lives in Framework. On GNU ld, an archive must appear on the link line before the archive that satisfies its undefined symbols. The #203 commit removed the standalone Build MafiaHubServices CI step, so the target now only gets built/linked transitively through FrameworkServer/FrameworkClient/FrameworkLoader which is exactly when the bad ordering occurrs.

  1. INTERFACE -> IMPORTED allows participation in dependency ordering against Framework
  2. target_link_libraries(MafiaHubServices INTERFACE Framework) declares the real dependency ordering so that CMake emits Framework after MafiaHubServices.

Summary by CodeRabbit

  • Chores
    • Updated the build configuration to improve reliability of linking between the framework and prebuilt services libraries.
  • Bug Fixes
    • Addressed linker ordering/symbol dependency issues by ensuring the framework is linked in the correct sequence when the services component is present.

The prebuilt MafiaHubServices was an INTERFACE library wrapping the raw
archive path, so the archive couldn't be ordered or captured by a link
group — order-dependent linkers dropped masterlist's Framework symbol
references. Make it a real IMPORTED STATIC target and declare its
dependency on Framework.
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aeff6aab-9514-4e98-a25b-5d7806c63a98

📥 Commits

Reviewing files that changed from the base of the PR and between b383c88 and 1584444.

📒 Files selected for processing (1)
  • code/framework/src/services/CMakeLists.txt
🚧 Files skipped from review as they are similar to previous changes (1)
  • code/framework/src/services/CMakeLists.txt

Walkthrough

MafiaHubServices is redeclared from an INTERFACE library to a STATIC IMPORTED GLOBAL library with IMPORTED_LOCATION and INTERFACE_INCLUDE_DIRECTORIES set directly on the target. A guarded target_link_libraries(MafiaHubServices INTERFACE Framework) is added in the framework root CMakeLists to enforce correct GNU ld link ordering.

Changes

MafiaHubServices CMake target type and link order

Layer / File(s) Summary
MafiaHubServices target declaration and Framework link ordering
code/framework/src/services/CMakeLists.txt, code/framework/CMakeLists.txt
MafiaHubServices is now declared as STATIC IMPORTED GLOBAL with IMPORTED_LOCATION pointing to the prebuilt archive and INTERFACE_INCLUDE_DIRECTORIES set on the target; the framework root CMakeLists adds a TARGET MafiaHubServices-guarded target_link_libraries(MafiaHubServices INTERFACE Framework) to ensure Framework is placed after MafiaHubServices by the linker.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 A library once INTERFACE-ly born,
Now STATIC IMPORTED like a crispy morn.
Link order matters, the linker must know —
Framework comes after, so symbols can flow.
With a guarded if(TARGET), all falls in place,
The rabbit hops on with a smile on its face! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: converting MafiaHubServices from an INTERFACE library to an imported static target, which is the primary technical change across the two modified CMake files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Segfaultd Segfaultd merged commit 494316d into MafiaHub:develop Jun 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants