Skip to content

fix: use -fmodule-map-file for Swift metadata discovery in nsld.sh#374

Merged
NathanWalker merged 1 commit into
mainfrom
fix/swift-headers
May 17, 2026
Merged

fix: use -fmodule-map-file for Swift metadata discovery in nsld.sh#374
NathanWalker merged 1 commit into
mainfrom
fix/swift-headers

Conversation

@edusperoni
Copy link
Copy Markdown
Collaborator

Replace HEADER_SEARCH_PATHS-based module discovery with explicit -fmodule-map-file= for the nsswiftsupport modulemap. The directory-based discovery via -I was unreliable — the metadata generator's clang would sometimes fail to find the modulemap, or during parallel multi-arch builds, discover modulemaps from both architectures through the parent internal/ directory (which is also in HEADER_SEARCH_PATHS), causing "redefinition of module 'nsswiftsupport'" errors and potentially using a stale bridging header from the wrong architecture.

This resulted in intermittent "ReferenceError: is not defined" errors for Swift plugin classes after npm install, requiring a full platforms/ delete to recover.

Replace HEADER_SEARCH_PATHS-based module discovery with explicit
-fmodule-map-file= for the nsswiftsupport modulemap. The directory-based
discovery via -I was unreliable — the metadata generator's clang would
sometimes fail to find the modulemap, or during parallel multi-arch
builds, discover modulemaps from both architectures through the parent
internal/ directory (which is also in HEADER_SEARCH_PATHS), causing
"redefinition of module 'nsswiftsupport'" errors and potentially using a
stale bridging header from the wrong architecture.

This resulted in intermittent "ReferenceError: <class> is not defined"
errors for Swift plugin classes after npm install, requiring a full
platforms/ delete to recover.
@NathanWalker NathanWalker merged commit ecd3598 into main May 17, 2026
8 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