Skip to content

module reserialization does not load VFS mappings #79839

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

Open
compnerd opened this issue Mar 7, 2025 · 2 comments
Open

module reserialization does not load VFS mappings #79839

compnerd opened this issue Mar 7, 2025 · 2 comments
Labels
Android Platform: Android bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. module maps serialization Area → compiler: Serialization & deserialization Windows Platform: Windows

Comments

@compnerd
Copy link
Member

compnerd commented Mar 7, 2025

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

  1. Checkout cc145482 and matching version from interface-bug-checkouts.log

  2. From your source root, start the build:

> swift\utils\build.cmd -SkipPackaging -EnableCaching -WindowsSDKs x64 -AndroidSDKs x86_64
  1. 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:

  1. usr\lib\swift\android\_math.swiftmodule lacks the "underlying Objective-C module '_math'"
  2. 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.

@compnerd compnerd added Android Platform: Android bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. module maps serialization Area → compiler: Serialization & deserialization Windows Platform: Windows labels Mar 7, 2025
@compnerd
Copy link
Member Author

compnerd commented Mar 7, 2025

CC: @xymus

compnerd added a commit to compnerd/apple-swift that referenced this issue Mar 7, 2025
These cannot be reserialized due to a bug in the serialization logic
where we do not inject the VFS Ovelay for the system modules.

Bug: swiftlang#79839
compnerd added a commit to compnerd/swift-installer-scripts that referenced this issue Mar 7, 2025
Remove the distribution of the resilient swift module interface due to a
bug in the reserialization process.

Bug: swiftlang/swift#79839
@finagolfin
Copy link
Member

I do not see this error on my Android CI, which runs on linux. Could this be related to the Swift compiler running on Windows, or the unique SDK layout you are using for Android there instead?

Btw, I never heard back from you if the final version of #74814 is working for your TBC builds now, would be good to sew that up.

compnerd added a commit to compnerd/apple-swift that referenced this issue Mar 10, 2025
These cannot be re-serialized due to a bug in the serialization logic
where we do not inject the VFS overlay for the system modules.

Bug: swiftlang#79839
weliveindetail pushed a commit to weliveindetail/swift that referenced this issue Mar 11, 2025
These cannot be re-serialized due to a bug in the serialization logic
where we do not inject the VFS overlay for the system modules.

Bug: swiftlang#79839
weliveindetail pushed a commit to weliveindetail/swift that referenced this issue Mar 13, 2025
These cannot be re-serialized due to a bug in the serialization logic
where we do not inject the VFS overlay for the system modules.

Bug: swiftlang#79839
hjyamauchi added a commit to hjyamauchi/swift that referenced this issue Mar 14, 2025
hjyamauchi added a commit to hjyamauchi/swift that referenced this issue Mar 14, 2025
weliveindetail pushed a commit to weliveindetail/swift that referenced this issue Mar 15, 2025
These cannot be re-serialized due to a bug in the serialization logic
where we do not inject the VFS overlay for the system modules.

Bug: swiftlang#79839
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Platform: Android bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. module maps serialization Area → compiler: Serialization & deserialization Windows Platform: Windows
Projects
None yet
Development

No branches or pull requests

2 participants