Skip to content

fix: link macOS CoreServices for the bundled notify/FSEvents backend#1875

Merged
kixelated merged 1 commit into
mainfrom
claude/clever-dirac-ca63da
Jun 22, 2026
Merged

fix: link macOS CoreServices for the bundled notify/FSEvents backend#1875
kixelated merged 1 commit into
mainfrom
claude/clever-dirac-ca63da

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Summary

The Go bindings (github.com/moq-dev/moq-go) and any C/CMake consumer of libmoq failed to link on macOS with undefined _FSEventStream* / _FSEvents* symbols:

Undefined symbols for architecture arm64:
  "_FSEventStreamCreate", referenced from:
      notify::fsevent::FsEventWatcher::run ... in libmoq_ffi.a
  ...
ld: symbol(s) not found for architecture arm64

Root cause: moq-native's default features enable quinn, which implies the watch feature and pulls in notify. Both moq-ffi and libmoq link moq-native with default features, so libmoq_ffi.a and libmoq.a bundle notify's FSEvents backend. Those symbols live in the macOS CoreServices framework, which the Go cgo flags and the libmoq CMake config did not link. Only build.rs's pkg-config already listed it (rs/libmoq/build.rs:33), so the three link configs were inconsistent. Linux uses inotify and needs no extra framework, which is why the Linux-only CI never caught it.

Changes

  • go/moq/cgo.go: add -framework CoreServices to both darwin,amd64 and darwin,arm64 LDFLAGS.
  • rs/libmoq/CMakeLists.txt + rs/libmoq/cmake/moq-config.cmake.in: add CoreServices, bringing the CMake / find_package(moq) path in line with build.rs. Confirmed libmoq.a carries the same undefined FSEvents symbols.
  • go/moq/link_test.go: a link smoke test. go build ./... compiles the cgo library but never links a binary, so a missing framework slips through compilation; go test ./... (already run by go/scripts/check.sh) now links a real test binary and surfaces it.

Test plan

  • nm confirms libmoq_ffi.a and libmoq.a both carry the 9 undefined _FSEvent* symbols.
  • On darwin/arm64, a consumer binary fails to link without the framework (exact bug-report error) and links + runs with it.
  • just go check green; the new link_test.go is staged and go test ./... passes. A/B confirmed the test fails the build without CoreServices and passes with it.
  • Swift checked (just swift check): unaffected, links and tests pass without declaring the framework (Apple-toolchain autolink). Kotlin/Python load the dynamic lib (rustc links it self-contained), so they are unaffected.

Targets main: a build/link fix, with no public API or wire-protocol change.

🤖 Generated with Claude Code

The Go bindings, and any C/CMake consumer of libmoq, failed to link on
macOS with undefined _FSEventStream* / _FSEvents* symbols.

moq-native's default features enable quinn, which implies the watch
feature and pulls in notify. Both moq-ffi and libmoq link moq-native with
default features, so libmoq_ffi.a and libmoq.a bundle notify's FSEvents
backend. Those symbols live in the macOS CoreServices framework, which the
Go cgo flags and the libmoq CMake config did not link. Only build.rs's
pkg-config already listed it, so the three link configs were inconsistent.
Linux uses inotify and is unaffected, which is why the Linux-only CI never
caught it.

- go/moq/cgo.go: add -framework CoreServices to both darwin LDFLAGS lines.
- rs/libmoq/CMakeLists.txt and cmake/moq-config.cmake.in: add CoreServices,
  matching build.rs.
- go/moq/link_test.go: a link smoke test. go build ./... compiles the cgo
  library but never links a binary, so the missing framework slipped
  through; go test ./... now links a real test binary and catches it.

Verified on darwin/arm64: a consumer binary fails to link without the
framework (the exact FSEvents errors) and links and runs with it; just go
check is green. Swift was checked too and is unaffected (its Apple-toolchain
link autolinks the framework).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kixelated kixelated enabled auto-merge (squash) June 22, 2026 19:30
@coderabbitai

coderabbitai Bot commented Jun 22, 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: 6254567f-8ece-4651-918d-15bae278e5fc

📥 Commits

Reviewing files that changed from the base of the PR and between 96203f3 and 87ddf72.

📒 Files selected for processing (4)
  • go/moq/cgo.go
  • go/moq/link_test.go
  • rs/libmoq/CMakeLists.txt
  • rs/libmoq/cmake/moq-config.cmake.in

Walkthrough

The macOS linker configuration for the moq package is extended to include the CoreServices Apple framework. This change is applied in three places: the Go cgo LDFLAGS directives for both darwin/amd64 and darwin/arm64 in go/moq/cgo.go, the CMake target_link_options for the moq interface target in rs/libmoq/CMakeLists.txt, and the INTERFACE_LINK_LIBRARIES for the moq::moq imported target in rs/libmoq/cmake/moq-config.cmake.in. A new empty TestLink test function is added in go/moq/link_test.go to exercise link-time resolution of cgo/FFI symbols during go test.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding CoreServices framework linking for macOS to fix FSEvents linking issues in the bundled notify backend.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the root cause, changes made, and testing performed for the CoreServices framework linking fix.
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/clever-dirac-ca63da

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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 merged commit ead91b0 into main Jun 22, 2026
1 check passed
@kixelated kixelated deleted the claude/clever-dirac-ca63da branch June 22, 2026 19:34
This was referenced Jun 22, 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