firebase-ios-sdk: Ignoring duplicate libraries: '-lc++', '-lsqlite3', '-lz'

Description

On Xcode 15 RC, when building an app using firebase-ios-sdk 10.15.0, a warning is raised on duplicated libraries:

Ignoring duplicate libraries: '-lc++', '-lsqlite3', '-lz'

Reproducing the issue

Build any project that requires Firebase

Firebase SDK Version

10.15.0

Xcode Version

15.0 RC

Installation Method

Swift Package Manager

Firebase Product(s)

Analytics, App Check, Authentication, Crashlytics, Firestore, Functions, Storage

Targeted Platforms

iOS

Relevant Log Output

ld: warning: ignoring duplicate libraries: '-lc++', '-lsqlite3', '-lz'


### If using Swift Package Manager, the project's Package.resolved

<!--- Look below for instructions on how to share your Package.resolved. --->

<details>
<summary>Expand <code>Package.resolved</code> snippet</summary>
<br>

The package inside another swift package (which contains the whole Cloud API of the app.

```swift
// swift-tools-version:5.8.1

import PackageDescription

let package = Package(
    name: "CloudKit",
    platforms: [.iOS(.v15), .macOS(.v12), .watchOS(.v8)],
    products: [
        .library(
            name: "CloudKit",
            targets: ["CloudKit"]
        ),
    ],
    dependencies: [
        .package(url: "https://github.com/firebase/firebase-ios-sdk.git", .upToNextMajor(from: "10.15.0")),
    ],
    targets: [
        .target(
            name: "CloudKit",
            dependencies: [
                .product(name: "FirebaseAnalytics", package: "firebase-ios-sdk", condition: .when(platforms: [.iOS, .macOS])),
                .product(name: "FirebaseAppCheck", package: "firebase-ios-sdk", condition: .when(platforms: [.iOS, .macOS])),
                .product(name: "FirebaseAuth", package: "firebase-ios-sdk"),
                .product(name: "FirebaseCrashlytics", package: "firebase-ios-sdk", condition: .when(platforms: [.iOS, .macOS])),
                .product(name: "FirebaseFunctions", package: "firebase-ios-sdk"),
                .product(name: "FirebaseFirestore", package: "firebase-ios-sdk", condition: .when(platforms: [.iOS, .macOS])),
                .product(name: "FirebaseFirestoreSwift", package: "firebase-ios-sdk", condition: .when(platforms: [.iOS, .macOS])),
                .product(name: "FirebaseStorage", package: "firebase-ios-sdk"),
            ]
        ),
        .testTarget(
            name: "CloudKitTests",
            dependencies: [
                "CloudKit",
            ]
        ),
    ]
)

If using CocoaPods, the project’s Podfile.lock

Expand Podfile.lock snippet

Replace this line with the contents of your Podfile.lock!

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Reactions: 32
  • Comments: 27 (10 by maintainers)

Commits related to this issue

Most upvoted comments

For anyone needing to silence this warning in their project you can update OTHER_LDFLAGS in your build settings to include -Xlinker -no_warn_duplicate_libraries

Screenshot 2023-09-20 at 1 29 08 PM

Edit/Note: This is in a simple Xcode project only using Swift Package Manager. There are quite a few ways to put together an Xcode project/workspace. Getting the flag to the correct destination will vary.

Can always trust Firebase to not be ready for a new Xcode version… surely this was known ahead of time with the beta and RC’s being available for so long? Nothing worse than warnings in a project that can’t be fixed…

Could we have a version we could manually point to for now, for XCode 15 specifically, until the issue is properly addressed?

For anyone needing to silence this warning in their project you can update OTHER_LDFLAGS in your build settings to include -Xlinker -no_warn_duplicate_libraries

Screenshot 2023-09-20 at 1 29 08 PM

@ricky-stone is it safe to do that ?

Hi. Same issue but I found this on homebrew github: https://github.com/orgs/Homebrew/discussions/4794

Adding ‘-Wl,-ld_classic’ in “Other Linker Flags” worked for me.

image

For anyone needing to silence this warning in their project you can update OTHER_LDFLAGS in your build settings to include -Xlinker -no_warn_duplicate_libraries

Screenshot 2023-09-20 at 1 29 08 PM

Thank you! Nothing worse than seeing that hazard sign!

After some investigation, we can only partly address this, since it’s fundamentally an Apple bug. One example that if you link two different libraries that include C++, Apple’s tools will add multiple -lc++ options to the link command. As a result, we’re going to close and recommend following up with Apple on the issue.

The workaround from @allenhumphreys of -Xlinker -no_warn_duplicate_libraries is recommended while the issue remains outstanding in Apple’s tools.

More context at https://indiestack.com/2023/10/xcode-15-duplicate-library-linker-warnings/

-Xlinker -no_warn_duplicate_libraries

FYI, Not working

Hi. Same issue but I found this on homebrew github: https://github.com/orgs/Homebrew/discussions/4794

Adding ‘-Wl,-ld_classic’ in “Other Linker Flags” worked for me.

image

And, Thanks @martinni87 ,

‘-Wl,-ld_classic’

This work for me. Thanks for the solution. XCode: Version 15.0 (15A240d) Mac mini 2023: Sonoma 14.0 (23A344)

so how critical this is? can it be ignored?

As far as I understand it, nothing has changed. The libraries were passed into the linker multiple times before Xcode 15. They just added a warning in the new linker.

That fundamentally changes the build to use the old linker I believe.

@paulb777 It will be a problem for those that configured ld to turn warnings into errors (I’m not one of those).

I couldn’t figure out how to label this issue, so I’ve labeled it for a human to triage. Hang tight.