Skip to content
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

Swift frontend incorrectly searching in SDK_ROOT for .swiftinterface file #79159

Open
luispadron opened this issue Feb 5, 2025 · 0 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@luispadron
Copy link

luispadron commented Feb 5, 2025

Description

We're hitting a bizarre issue that we've noticed since Xcode 16.0 where swiftc will look for a .swiftinterface in the SDK_ROOT. This obviously fails and thus the -compile-module-from-interface call fails.

Error:

<unknown>:0: error: cannot open file '/Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk/bazel-out/darwin_arm64-fastbuild/bin/test/fixtures/module_interface/library/toy_outputs/ToyModule.swiftinterface' (No such file or directory)
bazel-out/darwin_arm64-fastbuild/bin/test/fixtures/module_interface/library_consumer/toy_consumer_outputs/ToyModuleConsumer.swiftinterface:4:1: error: failed to build module 'ToyModuleConsumer' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
 2 | // swift-compiler-version: Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
 3 | // swift-module-flags: -target arm64-apple-macos13.0 -enable-objc-interop -enable-library-evolution -static -enforce-exclusivity=checked -Onone -enable-experimental-feature AccessLevelOnImport -enable-bare-slash-regex -module-name ToyModuleConsumer
 4 | import Swift
   | `- error: failed to build module 'ToyModuleConsumer' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
 5 | import ToyModule
 6 | import _Concurrency

Using the following invocation (on Xcode 16.2):

xcrun swiftc @ToyModuleConsumer.params 

With the following params file:

-frontend
-target
arm64-apple-macos13.0
-sdk
/Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk
-resource-dir
/Applications/Xcode-16.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift
-target-sdk-version
15.2
-Onone
-module-cache-path
bazel-out/darwin_arm64-fastbuild/bin/_swift_module_cache
-Ibazel-out/darwin_arm64-fastbuild/bin/test/fixtures/module_interface
-Xcc
-iquote.
-Xcc
-iquotebazel-out/darwin_arm64-fastbuild/bin
-color-diagnostics
-enable-bare-slash-regex
-Xcc
-O0
-Xcc
-DDEBUG=1
bazel-out/darwin_arm64-fastbuild/bin/test/fixtures/module_interface/library_consumer/toy_consumer_outputs/ToyModuleConsumer.swiftinterface
-enable-library-evolution
-o
bazel-out/darwin_arm64-fastbuild/bin/test/fixtures/module_interface/ToyModuleConsumer.swiftmodule
-compile-module-from-interface

I'm completely lost as to what could be causing swiftc to search in the SDK root here. The ToyModule.swiftinterface in this case is actually in: bazel-out/darwin_arm64-fastbuild/bin/test/fixtures/module_interface/library/toy_outputs/ToyModule.swiftinterface and looks like:

// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
// swift-module-flags: -target arm64-apple-macos13.0 -enable-objc-interop -enable-library-evolution -static -enforce-exclusivity=checked -Onone -enable-experimental-feature AccessLevelOnImport -enable-bare-slash-regex -module-name ToyModule
import Swift
import _Concurrency
import _StringProcessing
import _SwiftConcurrencyShims
@frozen public struct ToyValue {
  public var number: Swift.Int
  public var stringValue: Swift.String {
    get
  }
  public init(number: Swift.Int)
  public func squared() -> Swift.Int
}
extension ToyModule.ToyValue : Swift.Sendable {}
extension ToyModule.ToyValue : Swift.BitwiseCopyable {}

Steps to Reproduce

Use the -compile-module-from-interface mode to attempt to compile a .swiftmodule from a .swiftinterface that depends on another .swiftmodule (compiled from a interface).

Reproduction

Use the -compile-module-from-interface mode to attempt to compile a .swiftmodule from a .swiftinterface that depends on another .swiftmodule (compiled from a interface).

Expected behavior

I'd expect swiftc to not look in the SDK root here and to just work at compiling the interface as expected.

Environment

swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0

Additional information

No response

@luispadron luispadron added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant