Sqlite interop dll linux

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

sqlite error with linux-arm #311

sqlite error with linux-arm #311

Comments

when running on a raspberry pi it returns the error:

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 LD_DEBUG environment variable: libSQLite.Interop.dll: cannot open shared object file: No such file or directory
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 System.Data.SQLite.SQLiteConnection..ctor(String connectionString)
at Serilog.Sinks.SQLite.SQLiteSink.GetSqLiteConnection()
at Serilog.Sinks.SQLite.SQLiteSink.InitializeDatabase()
at Serilog.Sinks.SQLite.SQLiteSink..ctor(String sqlLiteDbPath, String tableName, IFormatProvider formatProvider, Boolean storeTimestampInUtc, Nullable 1 retentionPeriod, Nullable 1 retentionCheckInterval, UInt32 batchSize, UInt32 maxDatabaseSize, Boolean rollOver)
at Serilog.LoggerConfigurationSQLiteExtensions.SQLite(LoggerSinkConfiguration loggerConfiguration, String sqliteDbPath, String tableName, LogEventLevel restrictedToMinimumLevel, IFormatProvider formatProvider, Boolean storeTimestampInUtc, Nullable 1 retentionPeriod, Nullable 1 retentionCheckInterval, LoggingLevelSwitch levelSwitch, UInt32 batchSize, UInt32 maxDatabaseSize, Boolean rollOver)
at ErsatzTV.Program.Main(String[] args) in /home/runner/work/ErsatzTV/ErsatzTV/ErsatzTV/Program.cs:line 25
at ErsatzTV.Program.

The text was updated successfully, but these errors were encountered:

Источник

SQLite on Mono/Ubuntu: DllNotFoundException SQLite.Interop.dll

I developed a SQLite/C# application on Windows and am deploying it on a Ubuntu server. I downloaded the pre-compiled DLLs for MONO here https://system.data.sqlite.org/downloads/1.0.104.0/sqlite-netFx451-binary-Mono-2013-1.0.104.0.zip I downloaded the source code and compiled libSQLite.Interop.so using this script, and then moved libSQLite.Interop.so into the website’s bin folder alongside the other DLLs https://system.data.sqlite.org/index.html/artifact?ci=trunk&filename=Setup/compile-interop-assembly-release.sh It still complains about System.DllNotFoundException: SQLite.Interop.dll. I tried renaming libSQLite.Interop.so to SQLite.Interop.dll and that doesn’t help. What else do I need to do to get SQLite(EF6) to run on MONO on Ubuntu?

Читайте также:  Настройка сетевого экрана linux

2 Answers 2

You may clone source codes, and compile it in specific linux-env. A shortcut:

Building System.Data.SQLite Interop under Linux There’s no System.Data.SQLite package for Linux, so you’ll have to build it yourself on your target Linux machine. You can build using this procedure, which is tested in Raspbian Jessie on a Raspberry Pi 3 and Ubuntu 16.04.1 on a PC: Download System.Data.SQLite full source code from this download page. There’s a ton of files there, and the one you should look for is named something like sqlite-netFx-full-source-.zip. Unzip it and transfer it to a directory on your Linux machine. In the rest of this description, I’ll call this directory “”. Issue these commands in a Linux terminal: sudo apt-get update sudo apt-get install build-essential cd /Setup chmod +x compile-interop-assembly-release.sh ./compile-interop-assembly-release.sh Now, you will have a freshly built library file called libSQLite.Interop.so in the /bin/2013/Release/bin directory. This file might have execution permission which isn’t relevant for a library, so remove it by chmod -x /bin/2013/Release/bin/libSQLite.Interop.so Copy libSQLite.Interop.so the directory where your Mono/.NET application’s binaries reside (not the x64 or x86 subdirectories containing SQLite.Interop.dll), and you’re set to go. And that, ladies and gentlemen, is how we do that! 

Источник

System.DllNotFoundException on Mono SQLite

I’ve been trying to figure this out lately. It is working on my Windows machine, where I got SQLite from NuGet, but. When I put System.Data.SQLite.dll and SQLite.Interop.dll straight from my Windows machine into Linux server it says that SQLite.Interop.dll is not found, but I am sure I see it next right to executable. Then I tried to compile System.Data.SQLite.dll with /p:UseInteropDll=false , but with no luck. This time it says that System.Data.SQLite.dll is not found. What is this «not found» mystery?

Lile user3791372 said, turns out that you need to build System.Data.SQLite under Linux as there is no pre-build binaries to download — you can find the detailed instructions in this article: blog.wezeku.com/2016/10/09/…

5 Answers 5

No code changes necessary. You can build it yourself.

  1. apt-get install build-essentials unzip
  2. Download the SQLITE source code — you want the full source code. Currently called sqlite-netFx-full-source-1.0.104.0.zip.
  3. unzip and cd Source ,
  4. chmod +x the compile-interop-assembly-release.sh build shell script, then run it ./compile-interop-assembly-release.sh . — It’ll build an .so file in the ../bin directory.
  5. Copy this .so file to the directory that has your application in
  6. Run your application as normal.
  7. Note: Ensure that your SQLite database and the directory it’s inside of are writable by the user you’re trying to run as.
Читайте также:  Tar no such file or directory linux

On macOS, I noticed that copying the built libSQLite.Interop.dylib file (equivalent of the .so file on Linux) into the application directory may not work. Instead I’m copying libSQLite.Interop.dylib directly into /Library/Frameworks/Mono.framework/Libraries/

Hi, When I do that and try to launch the app I get a : «System.EntryPointNotFoundException: Unable to find an entry point named «sqlite3_key» in DLL «sqlite3″» Do you know why ?

I tried this, built without problems, version exactly matches my NuGet package version, and I get System.EntryPointNotFoundException: SIa069da76968b7553 which is. OK so the entry point is a hash? If they wanted to make it as difficult as possible, they succeeded.

Use Mono.Data.SQLite.dll on Linux. Take a look at the Mono manual to using SQLite on Linux or build the System.Data.SQLite.dll on Mono.

Unfortunately, that is not a useful solution when the application is supposed to run on both Mono and .NET.

The is a way to map differently on each platform, just deploy a different .config file for each platform

@Alexandre Marcondes, Our application is supposed to run on both Mono and .NET. How do we deploy a different .config file for Mono and .NET on Ubuntu Linux? Thank you.

I started the development in Windows, but then moved the application to Mono (Ubuntu 14), which is where the SQLite provider failed to load as OP described.

I had to recompile the System.Data.SQLite.dll using the following command:

MSBuild System.Data.SQLite.2012.csproj /t:Rebuild /p:UseInteropDll=false /p:UseSqliteStandard=true 

However, after this I’ve got the following exception:

The provider did not return a ProviderManifest instance. Method System.Data.SQLite.UnsafeNativeMethods:GetSettingValue (string,string)’ is inaccessible from method System.Data.SQLite.EF6.SQLiteProviderManifest:GetProviderManifestToken (string)’

To fix this, I had to recompile the System.Data.SQLite.EF6.dll using the following command:

MSBuild System.Data.SQLite.EF6.2012.csproj /t:Rebuild /p:UseInteropDll=false /p:UseSqliteStandard=true 

After copying all of the generated files to Mono project’s bin directory, everything worked.

The SQLite provider source code version I had used was 1.0.98.1.

Hope this saves someone a lot of time.

This worked for me. Don’t forget to build in Release mode with /p:Configuration=Release at the end. Building EF6 wasn’t necessary for me and didn’t compile anyway. First I tried compiling libSQLite.Interop.on the server so but never got that to work. Now it works. However, there are «unclear drawbacks» to not using the interop library. Something to keep in mind.

Читайте также:  Zabbix proc info linux

I tried all the above option but those options could not solve SQLite DLL problem, It may be because I am using ubuntu 18 version, So tried other option and here the steps,

2) unzip source code and cd to unzip directory

3) Run the following command in the terminal,

xbuild /p:Configuration=Release /p:UseInteropDll=false /p:UseSqliteStandard=true ./System.Data.SQLite/System.Data.SQLite.2010.csproj

4) Above command would create a dll file at following path,

5) Copy System.Data.SQLite.dll to your project bin folder.

6) Clean project and build again.

Starting with System.Data.SQLite.Core 1.0.109 you don’t need to compile anything yourself since the native SQLite.Interop.dll files are included in the NuGet package for all platforms (Linux, macOS and Windows). Note that although the dll extension is used for all platforms, the files are actually native dynamic libraries (usually suffixed dylib on macOS and so on Linux).

$ find ~/.nuget/packages/system.data.sqlite.core/1.0.111/runtimes -name SQLite.Interop.dll -print0 | xargs -0 file …/runtimes/linux-x64/native/netstandard2.0/SQLite.Interop.dll: ELF 64-bit LSB pie executable x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=96ce4120b31bad7d95f7b9ccf7c4bbb7717ae0b1, with debug_info, not stripped …/runtimes/osx-x64/native/netstandard2.0/SQLite.Interop.dll: Mach-O 64-bit dynamically linked shared library x86_64 …/runtimes/win-x86/native/netstandard2.0/SQLite.Interop.dll: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows …/runtimes/win-x64/native/netstandard2.0/SQLite.Interop.dll: PE32+ executable (DLL) (GUI) x86-64, for MS Windows 

Unfortunately, the MSBuild target responsible for copying the native dynamic libraries into the output directory only works on Windows. This is probably because the authors of the package assumed that .NET Framework only runs on Windows, which is not true thanks to Mono. Also, if you wanto to have a look, the CopySQLiteInteropFiles target can be found in ~/.nuget/packages/system.data.sqlite.core//build/net4*/System.Data.SQLite.Core.targets .

But it’s possible to automatically copy the SQLite.Interop.dll file into the output directory on Linux and macOS. Add the FixSQLiteInteropFilesOnLinuxAndOSX target (described below) in your csproj file and you’ll be able to use System.Data.SQLite.Core on Linux and macOS running mono without the DllNotFoundException . Here’s how your project should look like:

Make sure to add GeneratePathProperty=»true» in the package reference. This is required for the PkgSystem_Data_SQLite_Core property to be defined.

Источник

Оцените статью
Adblock
detector