No such module Synchronization in Embedded Swift

I am trying to use new Synchronization module with Embedded Swift mode, but it seems to fail with:

"error: no such module 'Synchronization'"

I am compiling it with:

xcrun -toolchain "Swift Development Snapshot" swiftc basic.swift -Xfrontend -disable-availability-checking -enable-experimental-feature Embedded -wmo

Do I need to specify some other flag or there is some more fundamental reason why this is not working?

There's probably two issues here:

  1. we likely haven't added this module to the embedded standard library (yet)
  2. platform support for various synchronization primaries varies and we haven't figured out how to expose this complexity.

Cc @kubamracek

We have figured out how to expose this complexity! Availability of atomic primitives can be checked on the target platform via _hasAtomicBitWidth. This should just be a question of configuring the build to build the module for that environment, and setting the conditionals appropriately. CC @Alejandro.

3 Likes

I stand corrected, adding the synchronization module should be pretty easy then!

1 Like

Given that we're not currently building the code for these environments, we might encounter some bugs once we do, but I expect that they will be pretty straightforward to resolve.

2 Likes

Right, I don't see why the Synchronization module should be problematic to enable in Embedded Swift. Took a stab at it here: [embedded] Start building Synchronization in embedded Swift mode by kubamracek · Pull Request #72293 · apple/swift · GitHub

2 Likes