Skip to content

The stdlib build currently only allows setting a single threading library type, even for multiple stdlibs #59568

Closed
@finagolfin

Description

@finagolfin

Describe the bug
Since #59287, it is possible to set a threading library for the Swift stdlib with SWIFT_THREADING_PACKAGE, which is set to the host platform by default. However, the current config builds all stdlibs with a single type of threading library, which can be overridden with the flag --swift-threading-package but still applies to every stdlib. Since it's possible to cross-compile multiple non-host stdlibs, this won't work if any of them need a different threading library, though it's fine if they're all Darwin platforms with the same type of threading library, say macOS and iOS.

To Reproduce

  1. Build multiple stdlibs that require different threading libraries, and watch it usually fail when all are built against the host threading library type.

Expected behavior
You should be able to build multiple stdlibs against different types of threading libraries.

Environment:

  • OS: Ubuntu 20.04 x86_64

Additional context
I just ran into this because the Android armv7 stdlib built fine on the community Android armv7 CI, but failed on my Android CI. I dug into it and it's because the host SDK on the community CI is LINUX so it applies that threading library to Android armv7 too, based on the default logic linked above. My own Android CI doesn't build for the linux host though, only for Android armv7 with the flags --cross-compile-hosts=android-armv7 --skip-local-build, so the host default logic chooses pthreads for the Android host and fails for armv7 only, as pthreads doesn't support 32-bit here.

In this case, it so happens that this issue is getting the Android build to pass, but in general, it's not a good idea to build all stdlibs against only one type of threading library.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions