Skip to content

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

Open
@jim108dev

Description

Describe the bug
I can't get most basic example like https://fsprojects.github.io/SQLProvider/core/sqlite.html working.

To Reproduce
Steps to reproduce the behavior:

  1. Create new console application.

    dotnet new console -lang F# -o SQLite
    cd SQLite
    dotnet add package SQLProvider
    dotnet add package System.Data.SQLite
  2. Build sqlite-netFx

    cd /tmp
    mkdir sqlite-netFx
    cd sqlite-netFx
    wget https://system.data.sqlite.org/downloads/1.0.115.5/sqlite-netFx-full-source-1.0.115.5.zip
    unzip sqlite-netFx-full-source-1.0.115.5.zip
    cd Setup
    sh compile-interop-assembly-debug.sh
    cp -rf bin/2013/Release/bin ~/github/fsharp_sqlprovider/SQLite/lib
  3. Add lib to SQLite.fsproj (in ItemGroup)

    <None Include="lib/libSQLite.Interop.so">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  4. Copy northwindEF.db from SQLProvider to SQLite/db

  5. Add to Program.fs

    open System
    open FSharp.Data.Sql
    
    [<Literal>]
    let connectionString =
        @"Data Source="
        + __SOURCE_DIRECTORY__
        + @"/db/northwindEF.db;Version=3;Read Only=false;FailIfMissing=True;"
    
    //If System.Data.SQLite.dll is in the location where NuGet places it by default, you don't have to submit the ResolutionPath parameter at all, but you still need to copy the interop libraries as described above.
    
    type sql =
        SqlDataProvider<Common.DatabaseProviderTypes.SQLITE, connectionString, CaseSensitivityChange=Common.CaseSensitivityChange.ORIGINAL, SQLiteLibrary=Common.SQLiteLibrary.SystemDataSQLite>
  6. Run

    dotnet run
    /home/a/github/fsharp_sqlprovider/SQLite/Program.fs(20,5): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Unable to load shared library 'SQLite.Interop.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libSQLite.Interop.dll: cannot open shared object file: No such file or directory [/home/a/github/fsharp_sqlprovider/SQLite/SQLite.fsproj]
    /home/a/github/fsharp_sqlprovider/SQLite/Program.fs(20,5): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Unable to load shared library 'SQLite.Interop.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libSQLite.Interop.dll: cannot open shared object file: No such file or directory [/home/a/github/fsharp_sqlprovider/SQLite/SQLite.fsproj]
    
    The build failed. Fix the build errors and run again.
    
  7. System information

    dotnet --info
    .NET SDK (reflecting any global.json):
    Version:   5.0.403
    Commit:    bf9d168ac2
    
    Runtime Environment:
    OS Name:     ubuntu
    OS Version:  20.04
    OS Platform: Linux
    RID:         ubuntu.20.04-x64
    Base Path:   /usr/share/dotnet/sdk/5.0.403/
    
    Host (useful for support):
    Version: 5.0.12
    Commit:  7211aa01b3
    
    .NET SDKs installed:
    3.1.415 [/usr/share/dotnet/sdk]
    5.0.403 [/usr/share/dotnet/sdk]
    
    .NET runtimes installed:
    Microsoft.AspNetCore.App 3.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 5.0.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
    Microsoft.NETCore.App 3.1.21 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
    Microsoft.NETCore.App 5.0.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
    
    To install additional .NET runtimes or SDKs:
    https://aka.ms/dotnet-download
    

Should this work? Is the documentation up to date? Which point am I missing?

Thank you!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions