Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?
[X] Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.
Description
Depending on the packages in the dependencies array in Package.swift, running swift run --repl and typing anything in the REPL leads to an couldn't IRGen expression: Clang importer error and redefinition of module errors and I can't even tell whether anything is getting executed or not.
Not all packages cause this; so far I've had this problem with
But for example .package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0") has not caused this.
I've tried
swift package reset && swift package purge-cache
rm -rf ~/Library/Caches/org.swift.swiftpm/
fd --hidden --no-ignore --ignore-case --glob "*modulecache*" /var/folders --exec rm -rf (to clear clang's module cache, based on an answer to this SO question)
Expected behavior
No errors.
Actual behavior
Example with only .package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0") as a dependency:
❯ swift run --repl
Building for debugging...
[5/5] Linking libProblemLib.dylib
Build complete! (2.92s)
Launching Swift REPL with arguments: repl -I/Users/teklof/Documents/Programming/swift/problem-package/.build/arm64-apple-macosx/debug -L/Users/myusername/Documents/Programming/swift/problem-package/.build/arm64-apple-macosx/debug -lproblem-package__REPL
Welcome to Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2).
Type :help for assistance.
1> let a = 1
a: Int = <extracting data from value failed>
couldn't IRGen expression: Clang importer error
error: /Users/myusername/Documents/Programming/swift/problem-package/.build/arm64-apple-macosx/debug/ArgumentParserToolInfo.build/module.modulemap:1:8: redefinition of module 'ArgumentParserToolInfo'
module ArgumentParserToolInfo {
^
error: /Users/myusername/Documents/Programming/swift/problem-package/.build/arm64-apple-macosx/debug/ArgumentParser.build/module.modulemap:1:8: redefinition of module 'ArgumentParser'
module ArgumentParser {
^
The exact module redefinition errors vary depending on which package(s) I've got in my dependencies.
Full swift run --repl -v outputs for the 3 problematic packages in an empty project like in the reproduction steps (includes one :swift-healthcheck output):
swift package init --type=library --disable-xctest --disable-swift-testing
run one of:
swift package add-dependency https://github.com/apple/swift-argument-parser --from 1.3.0
swift package add-dependency https://github.com/pointfreeco/swift-parsing --branch main
swift package add-dependency https://github.com/ordo-one/package-benchmark --from 1.4.0
swift run --repl
let a = 1
Swift Package Manager version/commit hash
Swift Package Manager - Swift 6.0.0-dev
Swift & OS version (output of swift --version ; uname -a)
Using the Swift toolchain from Xcode 16.0 (16A242d)
❯ swift --version ; uname -a
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx14.0
Darwin Myhostname.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6031 arm64
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
Depending on the packages in the
dependencies
array inPackage.swift
, runningswift run --repl
and typing anything in the REPL leads to ancouldn't IRGen expression: Clang importer error
andredefinition of module
errors and I can't even tell whether anything is getting executed or not.Not all packages cause this; so far I've had this problem with
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0")
.package(url: "https://github.com/pointfreeco/swift-parsing", branch: "main")
.package(url: "https://github.com/ordo-one/package-benchmark", from: "1.4.0")
But for example
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0")
has not caused this.I've tried
swift package reset && swift package purge-cache
rm -rf ~/Library/Caches/org.swift.swiftpm/
fd --hidden --no-ignore --ignore-case --glob "*modulecache*" /var/folders --exec rm -rf
(to clear clang's module cache, based on an answer to this SO question)Expected behavior
No errors.
Actual behavior
Example with only
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0")
as a dependency:The exact module redefinition errors vary depending on which package(s) I've got in my dependencies.
Full
swift run --repl -v
outputs for the 3 problematic packages in an empty project like in the reproduction steps (includes one:swift-healthcheck
output):https://gist.github.com/ORBAT/f29e1b15da3be9aeca9371f34ffe1752
Steps to reproduce
mkdir problem-package && cd problem-package
swift package init --type=library --disable-xctest --disable-swift-testing
swift package add-dependency https://github.com/apple/swift-argument-parser --from 1.3.0
swift package add-dependency https://github.com/pointfreeco/swift-parsing --branch main
swift package add-dependency https://github.com/ordo-one/package-benchmark --from 1.4.0
swift run --repl
let a = 1
Swift Package Manager version/commit hash
Swift Package Manager - Swift 6.0.0-dev
Swift & OS version (output of
swift --version ; uname -a
)Using the Swift toolchain from Xcode 16.0 (16A242d)