Skip to content

swift build --no-static-swift-stdlib fails after running swift build --static-swift-stdlib #5926

Closed as not planned
@MaxDesiatov

Description

@MaxDesiatov

Description

When switching between different linking modes on Linux, the build state is apparently not cleaned up correctly, which causes build errors.

Expected behavior

Running swift build --no-static-swift-stdlib after swift build --static-swift-stdlib should rebuild the project with correct linker settings with no errors.

Actual behavior

Build fails with this error message

error: link command failed with exit code 1 (use -v to see invocation)
/usr/bin/ld.gold: error: cannot find -lDispatchStubs
/usr/bin/ld.gold: error: cannot find -lCoreFoundation
/usr/bin/ld.gold: error: cannot find -luuid
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)

Steps to reproduce

  1. Generate a new project with swift package init --type executable
  2. Build it with swift build --static-swift-stdlib
  3. Build it again, now with swift build --no-static-swift-stdlib

Swift Package Manager version/commit hash

5.7.0

Swift & OS version (output of swift --version && uname -a)

Swift version 5.7 (swift-5.7-RELEASE)
Target: aarch64-unknown-linux-gnu
Linux 2e60786449d5 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions