Linker _sometimes_ fails at the first `swift build` but succeeds after several trials in a certain repository.
Opened this issue · 0 comments
YOCKOW commented
Is it reproducible with SwiftPM command-line tools: swift build
, swift test
, swift package
etc?
- 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
I don't know the implementation detail of Package Manager, but it seems to build 'libFoo-tool.dylib' and then emits 'libFoo.dylib' during swift build
.
However, under some conditions (which I'm not sure), swift build
instructs the linker to link 'libFoo.dylib' before it is emitted.
Expected behavior
swift build
always succeeds.
Actual behavior
error: link command failed with exit code 1 (use -v to see invocation)
ld: library 'Foo' not found
Steps to reproduce
(Sorry, but I couldn't reduce the problem. These steps use my repository as is.)
cd $(mktemp -d)
git clone https://github.com/YOCKOW/SwiftPQ.git
cd SwiftPQ/
git checkout 8bda04dd47316a52fb7c0a127e0db3091d2bd38f
swift build
Result (nondeterministic)
error: link command failed with exit code 1 (use -v to see invocation)
ld: library 'SwiftUnicodeSupplement' not found
(GitHub Actions Log: https://github.com/YOCKOW/SwiftPQ/actions/runs/11400394868/job/31860480405#step:8:14 )
or
error: link command failed with exit code 1 (use -v to see invocation)
ld: library 'SwiftNetworkGear' not found
or
Build complete!
Swift Package Manager version/commit hash
Swift Package Manager - Swift 6.0.1-dev
Swift & OS version (output of swift --version ; uname -a
)
Apple Swift version 6.0.1 (swift-6.0.1-RELEASE)
Target: arm64-apple-macosx15.0
Darwin yockow.local 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:39:07 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6000 arm64