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

Linker _sometimes_ fails at the first swift build but succeeds after several trials in a certain repository. #8064

Open
1 task done
YOCKOW opened this issue Oct 22, 2024 · 0 comments
Labels

Comments

@YOCKOW
Copy link
Member

YOCKOW commented Oct 22, 2024

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.)

  1. cd $(mktemp -d)
  2. git clone https://github.com/YOCKOW/SwiftPQ.git
  3. cd SwiftPQ/
  4. git checkout 8bda04dd47316a52fb7c0a127e0db3091d2bd38f
  5. 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
@YOCKOW YOCKOW added the bug label Oct 22, 2024
YOCKOW added a commit to YOCKOW/SwiftPQ that referenced this issue Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant