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

Unable to load shared library 'SQLite.Interop.dll' #298

Open
jake-carpenter opened this issue Feb 22, 2023 · 5 comments
Open

Unable to load shared library 'SQLite.Interop.dll' #298

jake-carpenter opened this issue Feb 22, 2023 · 5 comments

Comments

@jake-carpenter
Copy link

jake-carpenter commented Feb 22, 2023

Getting this error even on minimal tests. Is there something I'm missing for running with a M1 Mac?

What I'm doing

  • Creating ./V1__Testing.sql
create table dbo.Foo (
  Id int primary key identity(1,1),
  Bar varchar(100) null
)
  • Instaling Evolve.Tool globally
    dotnet tool install evolve.tool -g

  • Migrate against my database - It is SQL Server - not SQLite
    evolve migrate sqlserver -c "Data Source=localhost,5865;Database=master;User Id=sa;Password=Password12#;" -l ./

What's happening

$ evolve migrate sqlserver -c "Data Source=localhost,5865;Database=master;User Id=sa;Password=Password12#;" -l ./
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.TypeInitializationException: The type initializer for 'EvolveDb.Cli.Program' threw an 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, 0x0001): tried: 'libSQLite.Interop.dll' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibSQLite.Interop.dll' (no such file), '/usr/lib/libSQLite.Interop.dll' (no such file, not in dyld cache), 'libSQLite.Interop.dll' (no such file), '/usr/local/lib/libSQLite.Interop.dll' (no such file), '/usr/lib/libSQLite.Interop.dll' (no such file, not in dyld cache)
   at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
   at System.Data.SQLite.SQLite3.StaticIsInitialized()
   at System.Data.SQLite.SQLiteLog.PrivateInitialize(String className)
   at System.Data.SQLite.SQLiteLog.Initialize(String className)
   at System.Data.SQLite.SQLiteConnection..ctor(String connectionString, Boolean parseViaFramework)
   at System.Data.SQLite.SQLiteConnection..ctor(String connectionString)
   at EvolveDb.Cli.Program..cctor() in C:\projects\evolve\src\Evolve.Cli\Program.cs:line 14
   --- End of inner exception stack trace ---
   at EvolveDb.Cli.Program..ctor() in C:\projects\evolve\src\Evolve.Cli\Program.cs:line 50
   at System.RuntimeType.CreateInstanceOfT()
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication`1.DefaultModelFactory()
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication`1.CreateModel()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication`1.get_Model()
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication`1.McMaster.Extensions.CommandLineUtils.Abstractions.IModelAccessor.GetModel()
   at McMaster.Extensions.CommandLineUtils.Conventions.OptionAttributeConventionBase`1.<>c__DisplayClass0_0.<AddOption>b__1(ParseResult _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.HandleParseResult(ParseResult parseResult)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Parse(String[] args)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](CommandLineContext context, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](CommandLineContext context)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](IConsole console, String[] args)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](String[] args)
   at EvolveDb.Cli.Program.Main(String[] args) in C:\projects\evolve\src\Evolve.Cli\Program.cs:line 16
[1]    2715 abort      evolve migrate sqlserver -c  -l ./

Additional info

I am on an arm64 M1 Macbook Pro with both .net 6.0 and 7.0 sdks

$ dotnet --list-sdks
6.0.405 [/usr/local/share/dotnet/sdk]
7.0.102 [/usr/local/share/dotnet/sdk]

Attempted this with both 3.1.0 and 3.2.0-alpha1.

This minimal repro is tested working on both Windows 10 and an Intel Mac.

@jake-carpenter
Copy link
Author

It looks like this is a symptom of System.Data.SqlClient and arm64 which can be solved by using Microsoft.Data.SqlClient.

I've read the other threads where this was an issue, but I'm wondering if PR #291 addresses some of those issues?

@lecaillon
Copy link
Owner

Hi, it is probably because there is no OSX distibution of Evolve.

@lecaillon
Copy link
Owner

Oh sorry, you are using the .NET tool. So normally it should be ok. The issue seems to be linked to the SQLite driver. Not the SQL Server one btw

@lecaillon
Copy link
Owner

The SQLite driver used by Evolve is only compatible with x86 and x64 platform: https://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki

@lecaillon
Copy link
Owner

If you'd use the Evolve lib in your project it should work well btw, because no database driver is included in it

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

No branches or pull requests

2 participants