Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMake] Resolve module map conflict with duplicate in SDK #789

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

jmschonfeld
Copy link
Contributor

When building this package locally via CMake using a toolchain that contains the _FoundationCShims module, you currently encounter errors like:

/usr/lib/swift/_FoundationCShims/module.modulemap:1:8: error: redefinition of module '_FoundationCShims'
1 | module _FoundationCShims {
  |        `- error: redefinition of module '_FoundationCShims'
2 |     header "_FoundationCShims.h"
3 | 

/Repos/Public/swift-foundation/Sources/_FoundationCShims/include/module.modulemap:1:8: note: previously defined here
1 | module _FoundationCShims {
  |        `- note: previously defined here
2 |     header "_FoundationCShims.h"
3 | 

To solve this, we add an explicit -fmodule-map-file flag to swift clients which causes clang to prefer the local module over the module from the SDK. SwiftPM already applies this flag which is how the SwiftPM build works today.

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test

@jmschonfeld jmschonfeld merged commit f48c399 into swiftlang:main Jul 29, 2024
3 checks passed
@jmschonfeld jmschonfeld deleted the fix-local-cmake-build branch July 29, 2024 16:27
jmschonfeld added a commit to jmschonfeld/swift-foundation that referenced this pull request Jul 29, 2024
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.

3 participants