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

Can't add library using SPM #1916

Open
jose-pay opened this issue Jul 7, 2023 · 18 comments
Open

Can't add library using SPM #1916

jose-pay opened this issue Jul 7, 2023 · 18 comments
Assignees
Labels
lang: swift An issue with a Swift client library P1 Priority 1 issue (will likely block a customer in the future) platform: apple An issue with the macOS or iOS implementation project: connections An issue with the Connections project type: bug Something is broken or not working as intended

Comments

@jose-pay
Copy link

jose-pay commented Jul 7, 2023

Project

Nearby Connections

Language

Swift

OS Platform

Windows

What happened?

Followed instructions from this page:
https://github.com/google/nearby/

Searching for google/nearby using Xcode 14.3.1 results in nothing found.

The documentation should link to this GitHub page instead to make it easier to find the library.

Added https://github.com/google/nearby in SPM and this results in Xcode suggesting to check out the main branch? Why is not a specific version suggested?

Selecting "Up to Next Major Version" and typing in 1.0.0 results in:
"Failed to resolve dependencies Dependencies could not be resolved because no versions of 'nearby' match the requirement 1.0.0.. <2.0.0 and root depends o..."

What did you expect to happen?

Library was successfully added to project.

How can we reproduce it (as minimally and precisely as possible)?

  1. go to https://developers.google.com/nearby/connections/swift/get-started
  2. follow instructions on how to add project to an Xcode project using SPM

Notice that nothing is found when using the search term provided on this page.

How often does this bug happen?

Every time

Standalone code to reproduce the issue

No response

Relevant log output

No response

Anything else we need to know?

No response

@jose-pay jose-pay added needs-triage Issue still needs to be assigned, labeled and deduplicated type: bug Something is broken or not working as intended labels Jul 7, 2023
@bourdakos1
Copy link
Collaborator

Our SPM package is not versioned. You can either check out main branch or a commit hash

@jose-pay
Copy link
Author

jose-pay commented Jul 8, 2023

I have now tried to check out the main branch and commit 504ab8a without success.

I get the following error:
"© multiple products named 'abseil' in: 'abseil-cpp-binary', 'abseil-cpp-binary', 'abseil-cpp-swiftpm'"

My project is using Firebase as well, that also includes abseil.

@bourdakos1
Copy link
Collaborator

Hmm I'm guessing it's because we are using a fork of the abseil that firebase is using. Do you mind sharing which packages specifically you are using so I can try and reproduce the issue?

@bourdakos1 bourdakos1 self-assigned this Jul 8, 2023
@bourdakos1 bourdakos1 added P1 Priority 1 issue (will likely block a customer in the future) platform: apple An issue with the macOS or iOS implementation lang: swift An issue with a Swift client library project: connections An issue with the Connections project and removed needs-triage Issue still needs to be assigned, labeled and deduplicated labels Jul 8, 2023
@jose-pay
Copy link
Author

jose-pay commented Jul 9, 2023

{
  "pins" : [
    {
      "identity" : "abseil-cpp-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/abseil-cpp-binary.git",
      "state" : {
        "revision" : "bfc0b6f81adc06ce5121eb23f628473638d67c5c",
        "version" : "1.2022062300.0"
      }
    },
    {
      "identity" : "appauth-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/openid/AppAuth-iOS.git",
      "state" : {
        "revision" : "71cde449f13d453227e687458144bde372d30fc7",
        "version" : "1.6.2"
      }
    },
    {
      "identity" : "brightfutures",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Thomvis/BrightFutures.git",
      "state" : {
        "revision" : "fa66fa183dce7196d431244d0215748cd14c5758",
        "version" : "8.2.0"
      }
    },
    {
      "identity" : "bugfendersdk-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/bugfender/BugfenderSDK-iOS",
      "state" : {
        "revision" : "d15edbcd5b3bd8d1ab0c0e3511cc30776a5aad52",
        "version" : "1.12.1"
      }
    },
    {
      "identity" : "erik",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/phimage/Erik.git",
      "state" : {
        "revision" : "109a130e9cdb00789a43a7a625293eeb12d22989",
        "version" : "5.1.0"
      }
    },
    {
      "identity" : "facebook-ios-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/facebook/facebook-ios-sdk",
      "state" : {
        "revision" : "d001a0509c7051f8e16a0e9646cbde00e2f83ec1",
        "version" : "16.1.2"
      }
    },
    {
      "identity" : "filekit",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/nvzqz/FileKit.git",
      "state" : {
        "revision" : "9006d2888025fbe893c3c396327b2fe45a8c177b",
        "version" : "6.1.0"
      }
    },
    {
      "identity" : "firebase-ios-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/firebase-ios-sdk",
      "state" : {
        "revision" : "e700a8f40c87c31cab7984875fcc1225d96b25bf",
        "version" : "10.11.0"
      }
    },
    {
      "identity" : "googleappmeasurement",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleAppMeasurement.git",
      "state" : {
        "revision" : "62e3a0c09a75e2637f5300d46f05a59313f1c286",
        "version" : "10.11.0"
      }
    },
    {
      "identity" : "googledatatransport",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleDataTransport.git",
      "state" : {
        "revision" : "98a00258d4518b7521253a70b7f70bb76d2120fe",
        "version" : "9.2.4"
      }
    },
    {
      "identity" : "googlesignin-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleSignIn-iOS",
      "state" : {
        "revision" : "7932d33686c1dc4d7df7a919aae47361d1cdfda4",
        "version" : "7.0.0"
      }
    },
    {
      "identity" : "googleutilities",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleUtilities.git",
      "state" : {
        "revision" : "58d03d22beae762eaddbd30cb5a61af90d4b309f",
        "version" : "7.11.3"
      }
    },
    {
      "identity" : "grpc-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/grpc-binary.git",
      "state" : {
        "revision" : "f1b366129d1125be7db83247e003fc333104b569",
        "version" : "1.50.2"
      }
    },
    {
      "identity" : "gtm-session-fetcher",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/gtm-session-fetcher.git",
      "state" : {
        "revision" : "d415594121c9e8a4f9d79cecee0965cf35e74dbd",
        "version" : "3.1.1"
      }
    },
    {
      "identity" : "gtmappauth",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GTMAppAuth.git",
      "state" : {
        "revision" : "cee3c709307912d040bd1e06ca919875a92339c6",
        "version" : "2.0.0"
      }
    },
    {
      "identity" : "hero",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/HeroTransitions/Hero",
      "state" : {
        "revision" : "66a554b21116fccf61b3aa2205a86f6b0cdc9766",
        "version" : "1.6.2"
      }
    },
    {
      "identity" : "iqkeyboardmanager",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/hackiftekhar/IQKeyboardManager",
      "state" : {
        "revision" : "ea08e08958890043019d248065fe3d825f338087",
        "version" : "6.5.12"
      }
    },
    {
      "identity" : "kanna",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/tid-kijyun/Kanna.git",
      "state" : {
        "revision" : "f9e4922223dd0d3dfbf02ca70812cf5531fc0593",
        "version" : "5.2.7"
      }
    },
    {
      "identity" : "keychainaccess",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/kishikawakatsumi/KeychainAccess",
      "state" : {
        "revision" : "84e546727d66f1adc5439debad16270d0fdd04e7",
        "version" : "4.2.2"
      }
    },
    {
      "identity" : "leveldb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/leveldb.git",
      "state" : {
        "revision" : "0706abcc6b0bd9cedfbb015ba840e4a780b5159b",
        "version" : "1.22.2"
      }
    },
    {
      "identity" : "mkringprogressview",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/maxkonovalov/MKRingProgressView",
      "state" : {
        "revision" : "660888aab1d2ab0ed7eb9eb53caec12af4955fa7",
        "version" : "2.3.0"
      }
    },
    {
      "identity" : "nanopb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/nanopb.git",
      "state" : {
        "revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
        "version" : "2.30909.0"
      }
    },
    {
      "identity" : "nuke",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/kean/Nuke",
      "state" : {
        "revision" : "f67266f176af4add9f7a7020486826d82d562473",
        "version" : "12.1.2"
      }
    },
    {
      "identity" : "oauthswift",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/OAuthSwift/OAuthSwift",
      "state" : {
        "revision" : "d85964b96dbce94df961f28b996187c835089903",
        "version" : "2.2.0"
      }
    },
    {
      "identity" : "promises",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/promises.git",
      "state" : {
        "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a",
        "version" : "2.2.0"
      }
    },
    {
      "identity" : "rxdatasources",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/RxSwiftCommunity/RxDataSources",
      "state" : {
        "revision" : "90c29b48b628479097fe775ed1966d75ac374518",
        "version" : "5.0.2"
      }
    },
    {
      "identity" : "rxswift",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/ReactiveX/RxSwift",
      "state" : {
        "revision" : "9dcaa4b333db437b0fbfaf453fad29069044a8b4",
        "version" : "6.6.0"
      }
    },
    {
      "identity" : "swift-protobuf",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-protobuf.git",
      "state" : {
        "revision" : "f25867a208f459d3c5a06935dceb9083b11cd539",
        "version" : "1.22.0"
      }
    },
    {
      "identity" : "swifter",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/httpswift/swifter.git",
      "state" : {
        "revision" : "9483a5d459b45c3ffd059f7b55f9638e268632fd",
        "version" : "1.5.0"
      }
    },
    {
      "identity" : "swiftyuserdefaults",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/sunshinejr/SwiftyUserDefaults",
      "state" : {
        "revision" : "f66bcd04088582c8fbb5cb8554d577e303bae396",
        "version" : "5.3.0"
      }
    },
    {
      "identity" : "thirdpartymailer",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/vtourraine/ThirdPartyMailer",
      "state" : {
        "revision" : "44c1cfaa6969963f22691aa67f88a69e3b6d651f",
        "version" : "2.1.0"
      }
    }
  ],
  "version" : 2
}

@bourdakos1
Copy link
Collaborator

I'm having issues adding the firebase-ios-sdk I keep getting stuck at this screen:

image

@jose-pay
Copy link
Author

I didn't have any issues adding Firebase to the project. Maybe first add Firebase and then the nearby library.

@ugommirikwe
Copy link

ugommirikwe commented Nov 13, 2023

Any update on fixing this issue? Still unable to add the library via SPM whether using the main branch or commit SHA or release tag. I either see the error where Xcode says it can’t find the repo or it runs into the “abseil” conflict when I have Firebase-ios dependency.

@championofblocks
Copy link

@bourdakos1 at Monzo we're trying to migrate from the Nearby Messages SDK to this new one and we're hitting the abseil conflict too. we're using Tuist as a wrapper on SPM to manage our dependencies and the error we get is:

Swift/x86_64-apple-macos.swiftinterface:13577: Fatal error: Duplicate values for key: 'abseil'

Looks like it could be an issue with how the package is defined. Maybe it needs to have a transitive dependency on Firebase and/or abseil

@bourdakos1
Copy link
Collaborator

This may be tricky to resolve. I tried aliasing our C++17 fork of abseil and it fixed the multiple targets named 'abseil' build error, but if the FirebaseFirestore product is used, it will result in duplicate symbol linker errors. Using the actual https://github.com/firebase/abseil-cpp-SwiftPM.git package also doesn't work, because firebase-ios-sdk actually uses the https://github.com/google/abseil-cpp-binary.git package by default. Using https://github.com/google/abseil-cpp-binary.git fixes the multiple targets named 'abseil' build error, but we can't use the binary, because we build Nearby Connections from source and the abseil binary doesn't have useable headers :/

I'll try building using FIREBASE_SOURCE_FIRESTORE=1 with the https://github.com/firebase/abseil-cpp-SwiftPM.git package. However, we'll need to make our build compatible with C++14 which may take some time.

If that doesn't work, we could try doing a binary distribution of Nearby Connections.

@ugommirikwe
Copy link

So, any update on this then? @bourdakos1

@bourdakos1
Copy link
Collaborator

bourdakos1 commented Apr 1, 2024

I was able to make a bit of progress this weekend. Dynamic linking one of the libraries resolved the duplicate symbol linker errors I was seeing, which was the biggest blocker.

However, any shared dependencies still need to have unique product names and unique repo names. SPM doesn't disambiguate with repos with org names so firebase/abseil-cpp-SwiftPM and bourdakos1/abseil-cpp-SwiftPM is a considered a conflict. There aren't any repo name conflicts with Firebase by default, because Firebase uses the binary version of abseil (abseil-cpp-binary). However, if you build using FIREBASE_SOURCE_FIRESTORE=1 or using an older version of Firebase, you will run into this issue.

As of a few days ago, Firebase updated it's gRPC dependency in a way that it now conflicts with Nearby's use of BoringSSL-GRPC. This is almost identical to the abseil issue, but in this case we are using the actual Firebase SPM package instead of a fork. The reason for the conflict is due to Firebase using a binary by default, instead of https://github.com/firebase/boringssl-SwiftPM.git. Using the binary version of borinssl or using FIREBASE_SOURCE_FIRESTORE=1 should fix the issue, but not ideal since we'd be locking developers into either building Firebase with the binaries or from source and could easily break in the future.

Going forward, to avoid conflicts with Firebase, I think we'll need to:

  • Create forks (with unique names) of all the Firebase SPM package repos.
  • Rename all the products in packages to have a more guaranteed unique name (i.e.abseil -> NearbyAbseil).
    • (We could try using moduleAliases, but I don't think they work with C++ packages)
  • UPDATE: moduleAliases does seem to work, so we shouldn't need to create extra forks with renaming.
  • Expose NearbyConnections and NearbyConnectionsDynamic to give developers the option to dynamically link nearby if they are running into duplicate symbol issues.

Alternatively, we could discuss with Firebase on a product name scheme that causes less collisions with source vs binary builds. In theory, postfixing binary products with something like -binary would resolve the boringssl issue (and abseil, but we already require a fork and would need unique name anyway).

@bourdakos1
Copy link
Collaborator

@jose-pay @ugommirikwe @championofblocks Can you try using:

  • url: https://github.com/bourdakos1/nearby.git
  • branch: firebase-testing

And use the NearbyConnectionsDynamic target?

If that works, I'll submit #2386

@bourdakos1
Copy link
Collaborator

Closing, feel free to re-open if the issue persists.

@spectrl
Copy link

spectrl commented Dec 4, 2024

I'm running into a similar (the same?) issue when trying to add both the latest version of the firebase ios sdk (11.6.0) and the latest nearby main branch using SPM...

Removing Firebase allows me to add Nearby, and similarly I can add Firebase and not Nearby without any problems. But having them both together causes issues with FirebaseCore not resolving.

I've tried with the both the NearbyConnectionsDynamic and NearbyConnections target.

@bourdakos1
Copy link
Collaborator

@spectrl are you able to provide any logs?

@spectrl
Copy link

spectrl commented Dec 4, 2024

This is what I get when trying to add Nearby after already having Firebase in the project.

Image

"Add anyway" also (predictably) doesn't work

Image

@spectrl
Copy link

spectrl commented Dec 4, 2024

It's very easy to reproduce in a new project. Just add Firebase via SPM, and then try to add Nearby via SPM (which will fail to resolve).

@bourdakos1
Copy link
Collaborator

Thanks, I’ll take a look. Do you mind filing an issue with firebase as well, if you haven’t done so already?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: swift An issue with a Swift client library P1 Priority 1 issue (will likely block a customer in the future) platform: apple An issue with the macOS or iOS implementation project: connections An issue with the Connections project type: bug Something is broken or not working as intended
Projects
None yet
Development

No branches or pull requests

5 participants