swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.76k stars 1.35k forks source link

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

Open tamwei opened 1 month ago

tamwei commented 1 month ago

Is it reproducible with SwiftPM command-line tools: 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

dschaefer2 commented 1 month ago

Xcode report an error: duplicate symbol

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