Azure / Azure/azure-functions-core-tools
Unable to load shared library - MacOS/Linux x64
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 498
- Avg merge
- 5d 4h
- Merged PRs (30d)
- 15
Description
OS: Mac OS 11.6.5 (Intel x86-64) / PopOS 2110
Installed latest version of Azure Functions Core tools. (v4)
Using Microsoft.Data.Sqlite in azure functions project with HTTP trigger.
When attempting to connect to Database receiving following error:
`System.Private.CoreLib: Exception while executing function: test. Microsoft.Data.Sqlite: The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception. System.Private.CoreLib: Exception has been thrown by the target of an invocation. SQLitePCLRaw.provider.e_sqlite3: Unable to load shared library 'e_sqlite3' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libe_sqlite3, 1): image not found.`
Same project works fine in Windows 11.
A simple console app also works fine in MacOS using same SQLite DB and libs.
Therefore, I believe it's the Azure Functions Core toolkit
Easily re-produced by creating new azure func app on mac or linux -> add http trigger -> add package 'Microsoft.Data.Sqlite'.
Try to open a database example:
```
[FunctionName("test")]
public static async Task RunAsync(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
using (var dbConn = new SqliteConnection("Data Source=database.sqlite3"))
{
dbConn.Open();
dbConn.Close();
return new OkObjectResult("OK!");
}
}
```
Apologies in advance if anything omitted - this is my first bug report. Happy to provide any further info.
Contributor guide
Research direction
Reproduce the failure with Azure Functions Core Tools v4 on MacOS or PopOS using a C# HTTP-trigger function and Microsoft.Data.Sqlite. Start by checking how SQLitePCLRaw loads the e_sqlite3 shared library in this environment; done means the sample database connection opens successfully without the native-library exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, sqlite
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100