Skip to content

Conversation

compnerd
Copy link
Member

Adjust the build in three specific manners:

  1. hoist BlocksRuntime inclusion to the top level, it is not part of libdispatch
  2. only support a shared library build of libdispatch as the project conflates libdispatch and libclosure, and BUILD_SHARED_LIBS only permits us to globally control that behaviour
  3. adjust the libclosure build to include the necessary flags to support building against a static libclosure

After a side discussion between @rokhinip, @mikeash, @akmorrison, and myself (@compnerd), we decided that we should only support a dynamically linked libdispatch for the C portion of the runtime. While we have not yet decided on the direction for libclosure, in order to support the build of a static and dynamic libclosure, we pin the libdispatch build to a shared only build rather than just letting the build system control this via the BUILD_SHARED_LIBS global flag.

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test Linux platform

As per the discussion with @rokhinip, @mikeash, and @compnerd, always
build libdispatch and libclosure in shared mode. The rationale for this
is the following:

  If someone does a `-static-stdlib` build of Swift code as a plugin
  which is hosted in a C/C++ environment, you cannot have two dispatch
  implementations to run this. You need a single one, and because the
  host environment may be dynamically linked - you need to dynamically
  link libdispatch (the C portions).

This prepares us to be able to build the rest of the dispatch code
(swiftDispatch) both statically and dynamically.
@compnerd compnerd marked this pull request as draft August 11, 2025 17:58
@compnerd compnerd closed this Aug 26, 2025
@compnerd compnerd reopened this Aug 29, 2025
@compnerd compnerd marked this pull request as ready for review August 29, 2025 20:07
@rokhinip rokhinip requested review from mikeash and tbkka September 3, 2025 00:02
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