swiftlang/swift-package-manager

When using the static library built by spm, Xcode reports an error: Duplicate symbols

Opened this issue · 1 comments

tamwei 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

When a static library(framework) with a dependency was built in app, Xcode report an error: duplicate symbol

Expected behavior

The above swift static library can be used normally

Actual behavior

Xcode report an error: duplicate symbol

Steps to reproduce

Step:

  1. I created a static library(framework) with a dependency by spm.
  2. Then when I buld an app with the static library, Xcode reports an error: duplicate symbols

The following cases were tested:

  1. Using either the Alamofire dependency or the Firebase dependency alone in Xcode will result in compilation errors.
  2. No error will be reported when compiling the app under Objective-C, but an error will be reported when compiling the app under Swift.

Swift Package Manager version/commit hash

Swift Package Manager - Swift 5.9.0

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

1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx13.0

Xcode report an error: duplicate symbol

This contradicts the question above whether this was reproducible from the SwiftPM CLI.