realm-swift icon indicating copy to clipboard operation
realm-swift copied to clipboard

Realm built with library evolution support does not seem to work

Open alexanderwe opened this issue 1 year ago • 5 comments

How frequently does the bug occur?

Always

Description

Hey Realm Team,

I was looking into getting Realm working with library evolution support. I am using a pre-built binary of Realm in my application. Every time I upgrade Xcode I need to rebuild Realm for this new version. Therefore I tried to build realm with library evolution support. But I cannot get it to work. What I do locally is to execute:

export REALM_EXTRA_BUILD_ARGUMENTS="$REALM_EXTRA_BUILD_ARGUMENTS REALM_BUILD_LIBRARY_FOR_DISTRIBUTION=YES"

build.sh xcframework ios watchos

Which I would assume should build an .xcframework which includes the frameworks for iOS and watchOS as well as should support upcoming Swift compiler versions.

The issue I see now, when I do this with Xcode 14.3 and then want to use the built .xcframework in the next Xcode version or even in Xcode 15, the compiler tells me that the compiler version that I built Realm with is not compatible.

Do I have a wrong understand of REALM_BUILD_LIBRARY_FOR_DISTRIBUTION or maybe do I execute the command wrong ?

Therefore I am not sure if it's a bug or me just doing something. Any help is appreciated !

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

10.38.0

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS 16.5

Build environment

Xcode version: 14.3.0

alexanderwe avatar Jun 13 '23 18:06 alexanderwe

Hi @dianaafanador3, thanks a lot for this information.

Is there some issue or PR which I can subscribe to, to keep track of that implementation or is it just internally tracked ?

alexanderwe avatar Jul 12 '23 05:07 alexanderwe

Hi @alexanderwe I'm sorry about the comment above, it was meant to be for another issue which I was working at the moment as well. Even though we have support (we test this in our CI) for swift evolution, we had issues with supporting this in some Xcode versions. Current version of the SDK has some of this issues fixed and you can use swift evolution mode. This is tested generating the xcframwork with Xcode 14.1 and later using it in Xcode 14.3.1 and Xcode 15 Beta

dianaafanador3 avatar Jul 12 '23 08:07 dianaafanador3

@dianaafanador3 Hey, no worries, I was now constantly testing the evolution support and I might doing something wrong. Currently I am using 10.42.1 and trying to built it with Evolution support like so

export REALM_EXTRA_BUILD_ARGUMENTS="$REALM_EXTRA_BUILD_ARGUMENTS REALM_BUILD_LIBRARY_FOR_DISTRIBUTION=YES"
export REALM_XCODE_VERSION="15.0"
sh build.sh xcframework

Is this wrong ? Because when I want to use the xcframework that is built like this, I cannot use it in a new Swift Compiler version and I get the typical error that the code is built with another Swift compiler version cannot be used.

Does it happens because my Realm version is too old or is there some other mistake ?

alexanderwe avatar Oct 27 '23 07:10 alexanderwe

@alexanderwe have you figured out how to make this properly?

alxgrm avatar Jul 16 '24 16:07 alxgrm

@alxgrm Unfortunately I did not really invest into this. I was trying it with some newer Realm versions but then I started to simply build a new Realm version every new Xcode version by myself.

Even though I am still not sure whether my approach mentioned here: https://github.com/realm/realm-swift/issues/8273#issuecomment-1782423797 is correct. @dianaafanador3 do you maybe know if this is the correct way to build Realm with library evolution support enabled or does any of the officially built .xcframeworks already have library evolution support enabled by now ?

alexanderwe avatar Jul 22 '24 19:07 alexanderwe