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 #36

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

jmschonfeld
Copy link
Contributor

@jmschonfeld jmschonfeld commented Jul 26, 2024

When building the swift-foundation package locally via CMake using a toolchain that contains the _FoundationICU module, you currently encounter errors like:

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

/Repos/Public/swift-foundation-icu/icuSources/include/_foundation_unicode/module.modulemap:1:8: note: previously defined here
  1 | module _FoundationICU {
    |        `- note: previously defined here
  2 |     header "appendable.h"
  3 |     header "brkiter.h"

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 jmschonfeld changed the title Add explicit modulemap path to take priority over modulemap from SDK [CMake] Resolve module map conflict with duplicate in SDK Jul 26, 2024
@jmschonfeld
Copy link
Contributor Author

Full toolchain build passed with this change, merging

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.

4 participants