Swift 5.9. Type 'Bundle' has no member 'module' when building universal binary via swift build command

I'am trying to update my package for using swift 5.9. I used to build an universal executable binary via:

/usr/bin/swift build -c debug --package-path ~/work/MyLibrary --cache-path ~/.derived-tools/cache --scratch-path ~/.derived-tools/scratch --arch x86_64 --arch arm64

After migrating to

swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.2 clang-1500.0.40.1)
Target: arm64-apple-macosx13.0

That command started to fail with following error:

/Users/asevko/work/MyLibrary/Sources/MyLibrary/MyLibrary.swift:6:18: error: type 'Bundle' has no member 'module'
    print(Bundle.module.bundlePath)
          ~~~~~~ ^~~~~~

Build cancelled

Despite this, build command succeeds, when building separately for x86_64 and arm arch.

The structure of my sample project to reproduce that behaviour:


Archive of that project

Is that expected behaviour in swift 5.9?
Should i build two binaries and then merge them to get an universal executable binary?

1 Like

This should be fixed by [5.9] Fix an XCBuild compatibility issue by neonichu · Pull Request #6753 · apple/swift-package-manager · GitHub and [5.9] Fix another XCBuild compatibility issue by neonichu · Pull Request #6764 · apple/swift-package-manager · GitHub

1 Like