Skip to content

Unity 6 iOS | Unable to load dynamic library '/realm-wrappers'  #3693

@samclothier

Description

@samclothier

What happened?

We have been having the following error in our iOS builds when building from a Unity project with Realm.NET 10.19 after updating from Unity 2021.3.42f1 to Unity 6. (see stack trace) It builds successfully in Xcode but has this error in the console when the game is run on an iOS device.

Realm runs perfectly on the Windows, Mac, and Linux builds from this project.

I first checked Xcode for problems with embedding and linking the realm-wrappers.framework, but it is included in the final archive:

Image

Notably, this is different from the Frameworks folder we had in the archive before Unity 6:

Image
The .meta files used to be present and the realm-wrappers file was automatically detected as UNIX executable. Now with Unity 6 it would have to be made executable with chmod +x realm-wrappers, but doing this before Xcode starts archiving results in the same error in the build above.

The output directly from Unity (before Xcode touches it) looks similar. Before Unity 6:

Image

And after:

Image

Additionally, under Library > PackageCache > io.realm.unity, the meta files appear to be present and the realm-wrappers is not an executable:

Image

Inside Unity itself (before any build export has taken place) we noticed that the iOS realm-wrappers file was the only one that didn't have its platform ticked, although this also appeared to be the case in Unity 2021.3.42f1:

Image

The equivalent on Android, for example, looks like this:

Image

We don't know if the difference in the Frameworks folder is the actual issue or if it's just a symptom of a problem elsewhere.

We have tried deleting the package cache, reinstalling Realm into the project, and clearing the Library folder between builds. We have also tried updating Realm to the latest version but that caused other issues.

Note: using IL2CPP and .NET Standard 2.1

Repro steps

Using Realm.NET 10.19, currently trying to build an empty Unity 6 project with a debug window, ran directly from Xcode on a tethered device. It's proving very difficult to test.

Version

10.19

What Atlas Services are you using?

Local Database only

What type of application is this?

Unity

Client OS and version

iOS all versions

Code snippets

No response

Stacktrace of the exception/crash you're getting

DllNotFoundException: Unable to load DLL 'realm-wrappers'. Tried the load the following dynamic libraries: Unable to load dynamic library '/realm-wrappers' because of 'Failed to open the requested dynamic library (0x06000000) dlerror() = dlopen(/realm-wrappers, 0x0005): tried: '/realm-wrappers' (no such file), '/private/preboot/Cryptexes/OS/realm-wrappers' (no such file), '/realm-wrappers' (no such file)
Realms.SharedRealmHandle+NativeMethods.open (Realms.Native.Configuration configuration, Realms.Native.SchemaObject[] objects, System.Int32 objects_length, Realms.Native.SchemaProperty[] properties, System.Byte[] encryptionKey, Realms.NativeException& ex) (at <00000000000000000000000000000000>:0)
Realms.SharedRealmHandle.Open (Realms.Native.Configuration configuration, Realms.Schema.RealmSchema schema, System.Byte[] encryptionKey) (at <00000000000000000000000000000000>:0)
Realms.RealmConfiguration.CreateHandle (Realms.Schema.RealmSchema schema) (at <00000000000000000000000000000000>:0)
Realms.RealmConfigurationBase.CreateRealm () (at <00000000000000000000000000000000>:0)
RealmManager.InitialiseRealm () (at <00000000000000000000000000000000>:0)
RealmManager+<InitialiseServiceAsync>d__28.MoveNext () (at <00000000000000000000000000000000>:0)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <00000000000000000000000000000000>:0)

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions