System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: c438a5b5b9863c38253c6b5625f97d727dcddebf
Title: SQLite.Interop.dll fails to load on macOS (NuGet)
Status: Closed Type: Code_Defect
Severity: Important Priority: Medium
Subsystem: NuGetPackage Resolution: Duplicate
Last Modified: 2018-08-15 12:22:53
Version Found In: 1.0.109
User Comments:
anonymous added on 2018-08-14 10:02:17:
Complimentary to the d292f2e23d8a74e0e7619638a2ff1ccab973fffe bug.

On MacOS X @ .NET Core 2.1

I've put SQLite.Interop.dll from osx-x64 near the ConsoleApp6:

./ConsoleApp6.dll
./SQLite.Interop.dll
./ConsoleApp6.pdb
./ConsoleApp6.runtimeconfig.dev.json
./ConsoleApp6.runtimeconfig.json
./ConsoleApp6.deps.json

Also I've enabled DYLD_PRINT_LIBRARIES=1 environment variable. 

When I run my test program with "dotnet run" (or hit run button in IDE (rider)) I get following output:

dyld: ....
dyld: loaded: /Users/hazzik/Projects/ConsoleApp6/ConsoleApp6/bin/Debug/netcoreapp2.1/SQLite.Interop.dll

Unhandled Exception: System.DllNotFoundException: Unable to load shared library 'SQLite.Interop.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libSQLite.Interop.dll, 1): image not found
   at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
   at System.Data.SQLite.SQLite3.StaticIsInitialized()
   at System.Data.SQLite.SQLiteLog.Initialize(String className)
   at System.Data.SQLite.SQLiteConnection..ctor(String connectionString, Boolean parseViaFramework)
   at ConsoleApp6.Program.Main(String[] args) in /Users/hazzik/Projects/ConsoleApp6/ConsoleApp6/Program.cs:line 10

If I run the compiled program with "dotnet ConsoleApp6.dll" I get output as expected:

dyld: ...
dyld: loaded: /Users/hazzik/Projects/ConsoleApp6/ConsoleApp6/bin/Debug/netcoreapp2.1/SQLite.Interop.dll
Hello World!
dyld: unloaded: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.1.2/libhostpolicy.dylib

mistachkin added on 2018-08-14 11:14:07:
Closing as duplicate of [d292f2e23d8a74e0].

anonymous added on 2018-08-15 11:38:27:
Hi, this is not a duplicate. The DLL is loaded, but does not work in debug (when I debug in the IDE) I can see that library is loaded, but does not work for some reason.

mistachkin added on 2018-08-15 12:22:53:
Please make sure that the "System.Data.SQLite.dll.config" file is included in
the same directory as "System.Data.SQLite.dll".