Open
Description
Description
When re-serializing a swiftinterface to a swiftmodule, we do not inject the VFS overlay mappings for custom overlays (i.e. android.modulemap, ucrt.modulemap, winsdk.modulemap, visualc.modulemap). This results in the failure to "find" modules that are required.
Reproduction
-
Checkout cc145482 and matching version from interface-bug-checkouts.log
-
From your source root, start the build:
> swift\utils\build.cmd -SkipPackaging -EnableCaching -WindowsSDKs x64 -AndroidSDKs x86_64
- Find the build error out:
T:/x64/Android.platform/Developer/SDKs/Android.sdk\usr\lib\swift\android\_math.swiftmodule\x86_64-unknown-linux-android.private.swiftinterface:6:19: error: underlying Objective-C module '_math' not found
4 | // swift-module-flags-ignorable: -enable-lexical-lifetimes=false -enable-ossa-modules -interface-compiler-version 6.2
5 | import Swift
6 | @_exported import _math
| `- error: underlying Objective-C module '_math' not found
7 | @available(swift, deprecated: 3.0, message: "Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.")
8 | public let M_PI: Swift.Double
T:/x64/Android.platform/Developer/SDKs/Android.sdk\usr\lib\swift\android\_math.swiftmodule\x86_64-unknown-linux-android.private.swiftinterface:1:1: error: failed to build module '_math' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
1 | // swift-interface-format-version: 1.0
| `- error: failed to build module '_math' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
2 | // swift-compiler-version: Swift version 6.2-dev effective-5.10 (LLVM 1b5a84a64783fb8, Swift ab36a3aab1c59b4)
3 | // swift-module-flags: -target x86_64-unknown-linux-android -disable-objc-interop -autolink-force-load -enable-experimental-feature NoncopyableGenerics2 -enable-experimental-feature SuppressedAssociatedTypes -enable-experimental-feature SE427NoInferenceOnExtension -enable-experimental-feature NonescapableTypes -enable-experimental-feature LifetimeDependence -enable-upcoming-feature MemberImportVisibility -enable-library-evolution -module-link-name swift_math -swift-version 5 -O -library-level api -enforce-exclusivity=unchecked -disable-objc-interop -target-min-inlining-version min -module-name _math
T:/x64/Android.platform/Developer/SDKs/Android.sdk\usr\lib\swift\android\Android.swiftmodule\x86_64-unknown-linux-android.private.swiftinterface:6:19: error: no such module 'SwiftAndroid'
4 | // swift-module-flags-ignorable: -enable-lexical-lifetimes=false -enable-ossa-modules -interface-compiler-version 6.2
5 | import Swift
6 | @_exported import SwiftAndroid
| `- error: no such module 'SwiftAndroid'
7 | import SwiftOverlayShims
8 | import SwiftShims
<module-includes>:1:10: note: in file included from <module-includes>:1:
1 | #include "LibcOverlayShims.h"
| `- note: in file included from <module-includes>:1:
2 |
T:/x64/Android.platform/Developer/SDKs/Android.sdk\usr\lib\swift\android\Android.swiftmodule\x86_64-unknown-linux-android.private.swiftinterface:6:19: error: no such module 'SwiftAndroid'
4 | // swift-module-flags-ignorable: -enable-lexical-lifetimes=false -enable-ossa-modules -interface-compiler-version 6.2
5 | import Swift
6 | @_exported import SwiftAndroid
| `- error: no such module 'SwiftAndroid'
7 | import SwiftOverlayShims
8 | import SwiftShims
<module-includes>:1:10: note: in file included from <module-includes>:1:
1 | #include "LibcOverlayShims.h"
| `- note: in file included from <module-includes>:1:
2 |
T:/x64/Android.platform/Developer/SDKs/Android.sdk\usr\lib\swift\android\Synchronization.swiftmodule\x86_64-unknown-linux-android.private.swiftinterface:5:8: error: failed to build module 'Android' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
3 | // swift-module-flags: -target x86_64-unknown-linux-android -disable-objc-interop -enable-experimental-feature NoncopyableGenerics2 -enable-experimental-feature SuppressedAssociatedTypes -enable-experimental-feature SE427NoInferenceOnExtension -enable-experimental-feature NonescapableTypes -enable-experimental-feature LifetimeDependence -enable-upcoming-feature MemberImportVisibility -enable-experimental-feature RawLayout -enable-experimental-feature StaticExclusiveOnly -enable-experimental-feature Extern -enable-library-evolution -module-link-name swiftSynchronization -swift-version 5 -O -library-level api -enable-builtin-module -enforce-exclusivity=unchecked -disable-objc-interop -target-min-inlining-version min -module-name Synchronization
4 | // swift-module-flags-ignorable: -strict-memory-safety -enable-lexical-lifetimes=false -interface-compiler-version 6.2
5 | import Android
| `- error: failed to build module 'Android' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
6 | import Builtin
7 | import Swift
<module-includes>:1:10: note: in file included from <module-includes>:1:
1 | #include "LibcOverlayShims.h"
| `- note: in file included from <module-includes>:1:
2 |
ninja: build stopped: subcommand failed.
Error: Error: cmake.exe exited with code 1.
Explanation:
usr\lib\swift\android\_math.swiftmodule
lacks the "underlying Objective-C module '_math'"usr\lib\swift\android\Android.swiftmodule
lacks the "SwiftAndroid" module, which is a Clang Module
These dependencies are defined in the android.modulemap, which can be found in subfolder usr/lib/swift/android/x86_64
of the just-built SDK.
Expected behavior
Build succeeded.
Environment
Swift version 6.2-dev (LLVM 524292147b7ee80, Swift cc145482de3b9b9)
Target: x86_64-unknown-linux-android28
Additional information
Workaround is to remove all *.swiftinterface
files from the Android SDK folder. This will force the compiler to use the binary swift modules, which should work.