Skip to content

fix(libmoq): declare the full Windows system-lib set for C consumers#1792

Merged
kixelated merged 1 commit into
mainfrom
claude/libmoq-windows-link-libs
Jun 19, 2026
Merged

fix(libmoq): declare the full Windows system-lib set for C consumers#1792
kixelated merged 1 commit into
mainfrom
claude/libmoq-windows-link-libs

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

When an external linker consumes libmoq.a on Windows, cargo cannot inject the system libraries Rust std/deps require, so they must be declared in the CMake config consumers link against.

The find_package config (rs/libmoq/cmake/moq-config.cmake.in) listed only ws2_32/userenv/bcrypt/ntdll; this adds dbghelp/advapi32/legacy_stdio_definitions to match cargo rustc -- --print native-static-libs. The same set is mirrored onto the add_subdirectory moq target so both consumption paths (released config + in-tree) link cleanly.

Surfaced while linking libmoq.a into a C++ consumer on Windows (__imp_NtCreateNamedPipeFile and similar unresolved externals).

(Written by Claude)

When an external linker consumes libmoq.a on Windows, cargo can't inject the
system libraries Rust's std/deps need, so they must be declared in the CMake
config. The find_package config (moq-config.cmake.in) listed only
ws2_32/userenv/bcrypt/ntdll; add dbghelp/advapi32/legacy_stdio_definitions to
match `cargo rustc -- --print native-static-libs`. Mirror the same set on the
add_subdirectory `moq` target so both consumption paths link cleanly (fixes
__imp_NtCreateNamedPipeFile and friends when linking from C++ on Windows).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

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: 4d92ec90-da03-4eac-a350-8b6c3a10d372

📥 Commits

Reviewing files that changed from the base of the PR and between 2caa732 and b47cc06.

📒 Files selected for processing (2)
  • rs/libmoq/CMakeLists.txt
  • rs/libmoq/cmake/moq-config.cmake.in

Walkthrough

Two CMake files for the libmoq Rust static library are updated to declare Windows-specific interface link libraries. CMakeLists.txt gains a WIN32 conditional block on the moq INTERFACE target's target_link_libraries call, adding ntdll, userenv, ws2_32, bcrypt, dbghelp, advapi32, and legacy_stdio_definitions. The installed config template moq-config.cmake.in mirrors this change by expanding the INTERFACE_LINK_LIBRARIES property in its own WIN32 block with the same additional libraries, reformatted across multiple lines.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: declaring the full set of Windows system libraries needed for C consumers of libmoq. It is concise, specific, and directly related to the primary change in the changeset.
Description check ✅ Passed The description provides clear context about the Windows linking issue, explains why the change is needed, details what was modified, and references the cargo command used to determine the correct libraries. It is directly related to and explains the changeset.
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
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/libmoq-windows-link-libs

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.

@kixelated kixelated enabled auto-merge (squash) June 19, 2026 05:31
@kixelated kixelated merged commit ea94b7b into main Jun 19, 2026
1 check passed
@kixelated kixelated deleted the claude/libmoq-windows-link-libs branch June 19, 2026 05:34
@moq-bot moq-bot Bot mentioned this pull request Jun 19, 2026
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.

1 participant