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

Realm Swift SDK v10.49.3 changed the details for installing the package with Swift Package Manager (SPM) #214

Open
lluisgerard opened this issue May 3, 2024 · 9 comments
Assignees
Labels

Comments

@lluisgerard
Copy link
Contributor

As explained on Realm documentation Swift Package Target Cannot be Built Dynamically, you now have to select either a Realm or RealmSwift library. For this project only RealmSwift should be selected.

At the moment, if you create a project from scratch and you just add RxRealm as a dependency you get this error:

Swift package target `Realm` is linked as a static library by `TargetName`
--
and `Realm`, but cannot be built dynamically because there is a package
product with the same name.

image

I uploaded more info in this comment on another thread in Realm github repo: realm/realm-swift#8566 (comment)

I tried doing this myself but I cannot get the project to compile for some reason so I decided to report it here in the meantime.

If choosing only RealmSwift is not possible, in the meantime we could also limit the version to v10.49.2 (the one before they changed this).

@lluisgerard
Copy link
Contributor Author

I forked the project and removed "Realm" library everywhere. It seems to work for me when pointing SPM to my work. I didn't add "Embed & Sign".

main...fieldmargin:RxRealm:main

@HyenaJeremyLin
Copy link

I encountered the same problem, is there any update?

@freak4pc
Copy link
Member

freak4pc commented May 7, 2024

As far as I know this project doesn't have an active maintainer. If someone has a PR I can try and help

@lluisgerard
Copy link
Contributor Author

As far as I know this project doesn't have an active maintainer. If someone has a PR I can try and help

I added a PR that works for me in SPM where I removed any reference to "Realm" and kept "RealmSwift". #215 I don't know how it affects Cocoapods or Carthage thought.

@JoeMatt
Copy link
Contributor

JoeMatt commented May 7, 2024

As far as I know this project doesn't have an active maintainer. If someone has a PR I can try and help

I'm maintaining but I have some limited access to the repo and settings.

I merged what I could as best as I could.

I think I have access to public podpsecs, I need to refresh my memory.

Are we no longer using the Slack by the way?

@JoeMatt
Copy link
Contributor

JoeMatt commented May 7, 2024

FYI, point to main branch for now and it should work.

@JoeMatt
Copy link
Contributor

JoeMatt commented May 8, 2024

I'm having issues where I get past the linker error, but now it's saying missing symbols.

If I add back Realm into the SPM, I get that "static link" error again.

I'm trying to figure out if that's a local project issue or something I need to fix in the Package.swift

@JoeMatt JoeMatt self-assigned this May 8, 2024
@JoeMatt
Copy link
Contributor

JoeMatt commented May 8, 2024

I'm stuck in a loop in my own app. I've been testing my local checkout and doing all sort of things to the Package.swift.

I can either get it to not have that static issue, or it complains about missing symbols that are in the Realm, not RealmSwift, package.

In theory, these should be linked.

I tried making both dynamic and static versions and using both.

I'm at a lost. Realm Swift is such a PITA to work with.

I'm going to force an older version myself and if anyone has any ideas or fixes, please let me know and make a PR if you can.

image

@lluisgerard
Copy link
Contributor Author

@JoeMatt can you try adding realm to your project as explained here as if RxRealm had no dependency?
https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/install/#installation

Try doing step 5 (add to Frameworks and Libraries) with Embed & Sign). Let me know if that works for you. I even sent a build to TestFlight and passed review (I was testing our Privacy Manifest).

There might be a way to do this automatically as a dependency, I'll see if there's anyrhing I can do. If it's not possible I will update the README file to add this information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants