I am trying to deploy a lightweight ASP application on Raspberry Pi 3 Model B (running 64-bit Raspbian Lite, .NET RID is linux-arm64) with Apache2. I am developing on Linux Mint with ASP.Net Core 7 and compiling to linux-arm64 for my Raspberry Pi. My application relies on SQLite3. I tried compiling every way, but no matter what I do, when I run it on my Raspberry Pi I get:
# 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 using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
/var/www/html/leafletasp/SQLite.Interop.dll.so: cannot open shared object file: No such file or directory
/var/www/html/leafletasp/libSQLite.Interop.dll.so: cannot open shared object file: No such file or directory
/var/www/html/leafletasp/SQLite.Interop.dll: cannot open shared object file: No such file or directory
/var/www/html/leafletasp/libSQLite.Interop.dll: cannot open shared object file: No such file or directory
Many of the packages included don't appear to have matching DLLs or SOs. I don't know what should and shouldn't be there, but notable absences are:
- System.Data.SQLite.Core
- Stub.System.SQLite.Core.NetStandard (although netstandard.dll is present)
- Everything regarding SQLite.Interop
Almost all of these yield the same error log when I attempt to run them:
- Compile as self-contained and run with or without the ASP.NET runtime.
- Compile as a self-contained single file.
- Compile completely default non-self-contained and run with ASP.NET runtime.
- Install the following NuGet packages and put them in dependencies:
- System.Data.SQLite
- Stub.System.Data.SQLite.Core.NetStandard
- System.Data.SQLite.Core
- System.Data.SQLite.EF6
- Add the
<ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles>
tag to my .csproj. - Add the
PrivateAssets="none"
tag to all package references that involve SQLite (as per direction of another answer). - Add
<PackageReference Include="SQLite.Interop" Version="1.0.0"/>
. This throws compiler warnings that the package is not compatible with SDK 7 and must be inferred from Framework 4.8. Adding this does include SQLite.Interop.dll in the compiled binaries but throws an error when run, stating it has invalid ELF header. - Install latest apt package for sqlite3 and libsqlite3-dev.
.csproj file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<!-- does not appear to affect anything at all-->
<ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles>
<CopySQLiteInteropFiles>false</CopySQLiteInteropFiles>
<CleanSQLiteInteropFiles>false</CleanSQLiteInteropFiles>
<CollectSQLiteInteropFiles>false</CollectSQLiteInteropFiles>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.49" />
<PackageReference Include="Markdig" Version="0.31.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SQLite.Interop.dll" Version="1.0.103" PrivateAssets="none"/>
<PackageReference Include="Stub.System.Data.SQLite.Core.NetStandard" Version="1.0.118" PrivateAssets="none"/>
<PackageReference Include="System.Data.SQLite" Version="1.0.118" PrivateAssets="none"/>
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.118" PrivateAssets="none"/>
<PackageReference Include="System.Data.SQLite.EF6" Version="1.0.118" PrivateAssets="none"/>
</ItemGroup>
<ItemGroup>
<Folder Include="Views\" />>
</ItemGroup>
</Project>
I know getting ASP to run using Apache is a whole other hurdle, I just want to get the program to show any sign of life on Raspberry Pi.