Problem opening libsqlite3.0.dylib in Unity on MacOS
Background:
We have an application for office pause gymnastics. A user defined number of times a day, our app notifies the user to do a couple of exercises to prevent occupational injuries.
There is three parts of the application:
-The Player where the exercises are shown with instructions
-A launcher that keeps track of time and notifies the user that its time to do exercises
-A DBUpgrade app that updates the database if a new version is installed.
The player was written in Unity with the mono runtime. It communicated with the database to read settings and language specific texts.
The launcher was written in ObjectiveC for Mac and .NET for Windows
The DBUpgrade app was written in mono.
All worked fine on all Macs (and on Windows) so far.
In February 2021 we made following changes:
Started signing the application with Apple, and ran into problems signing the DBUpgrade application, so we switched to .NET 6 Preview 1 for it.
.NET 6 Preview 1 had built in support for sqlite and was easily signed.
The app was signed and sent to customers having MacOS.
From then on, several bug reports came in, claiming the app wasn't working. Not all, but some of the MacOS users just got a white screen, nothing happened when the app started.
Problem:
The Player.log has theese lines in them:
Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib.so Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib.bundle Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib.so Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib.bundle Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib.so Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib.bundle Fallback handler could not load library /Applications/Pausit.app/Contents/Applications/Pausit.app/Contents/Frameworks/MonoEmbedRuntime/osx/libsqlite3.0.dylib DllNotFoundException: libsqlite3.0.dylib at (wrapper managed-to-native)
Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_open_v2(byte[],intptr&,int,intptr) at Mono.Data.Sqlite.SQLite3.Open (System.String strFilename, Mono.Data.Sqlite.SQLiteOpenFlagsEnum flags, System.Int32 maxPoolSize, System.Boolean usePool) [0x00046] in :0 at Mono.Data.Sqlite.SqliteConnection.Open () [0x0021a] in :0 at Database.DisposableDbConnection..ctor () [0x00027] in :0 at Services.DatabaseService.GetSettings () [0x00006] in :0 at Services.SettingsService.GetSettings () [0x00009] in :0 at Services.SettingsService.Initialize () [0x00000] in :0 at Bootstrapper.Awake () [0x00000] in :0
(Filename: Line: 0)
DllNotFoundException: libsqlite3.0.dylib at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_open_v2(byte[],intptr&,int,intptr) at Mono.Data.Sqlite.SQLite3.Open (System.String strFilename, Mono.Data.Sqlite.SQLiteOpenFlagsEnum flags, System.Int32 maxPoolSize, System.Boolean usePool) [0x00046] in :0 at Mono.Data.Sqlite.SqliteConnection.Open () [0x0021a] in :0 at Database.DisposableDbConnection..ctor () [0x00027] in :0 at Services.DatabaseService.GetSettings () [0x00006] in :0 at Services.SettingsService.GetSettings () [0x00009] in :0 at SceneSelector.LoadStartScene (System.Boolean shouldLoadPlayer) [0x00003] in :0 at SceneSelector.Start () [0x0003c] in :0
(Filename: Line: 0)
We have tried to manually add the libsqlite3.0.dylib as a Plugin, with no success.
We found this bug (https://issuetracker.unity3d.com/issues/macos-native-plugins-not-detected-or-misplaced-in-builds) but after upgrading to latest 2019-version (2019.4.28f1) it still didn't work.
This happens to SOME of the MacOs users, not all. So its hard to reproduce. The test macs we have at our disposal does not get this problem.
Any help or ideas would be appreciated!