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

dispatch: install the correct modulemap when building static #793

Merged
merged 1 commit into from
Jun 5, 2023

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Jun 2, 2023

There is a subtle difference between libdispatch built dynamically and statically: DispatchStubs. We erroneously emit ObjC runtime calls into the build and the stubs provides a shim to provide a definition on non-ObjC runtime enabled targets. When built dynamically, this is internalised and distributed as part of dispatch.dll/libdispatch.so, however when built statically, the consumer is responsible for linking against DispatchStubs. The modulemap reflects this and we need to ensure that we correctly provide that modulemap.

Thanks to @MaxDesiatov for the help with debugging and testing a fix for this!

@compnerd
Copy link
Member Author

compnerd commented Jun 2, 2023

@swift-ci please test

@MaxDesiatov
Copy link
Contributor

For posterity, this is related to rdar://23335318

@MaxDesiatov MaxDesiatov added Linux static linking issues and changes related to statically linked Dispatch labels Jun 2, 2023
@MaxDesiatov
Copy link
Contributor

Both in cross-repo testing and for this PR specifically it fails with

<unknown>:0: error: module map file '/home/build-user/swift-corelibs-libdispatch/dispatch/module.modulemap' not found
/home/build-user/swift-corelibs-libdispatch/src/swift/Block.swift:13:8: error: no such module 'CDispatch'
import CDispatch

@compnerd
Copy link
Member Author

compnerd commented Jun 5, 2023

@swift-ci please test

@MaxDesiatov
Copy link
Contributor

@swift-ci test windows

There is a subtle difference between libdispatch built dynamically and
statically: DispatchStubs.  We erroneously emit ObjC runtime calls into
the build and the stubs provides a shim to provide a definition on
non-ObjC runtime enabled targets.  When built dynamically, this is
internalised and distributed as part of dispatch.dll/libdispatch.so,
however when built statically, the consumer is responsible for linking
against DispatchStubs.  The modulemap reflects this and we need to
ensure that we correctly provide that modulemap.

Thanks to @MaxDesiatov for the help with debugging and testing a fix for
this!

Fixes: rdar://23335318
@compnerd
Copy link
Member Author

compnerd commented Jun 5, 2023

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linux static linking issues and changes related to statically linked Dispatch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants