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 - MacOS x64 #2193

Open
cipherw0lf opened this issue Apr 5, 2022 · 4 comments
Open

Unable to load shared library - MacOS x64 #2193

cipherw0lf opened this issue Apr 5, 2022 · 4 comments
Assignees
Labels

Comments

@cipherw0lf
Copy link

cipherw0lf commented Apr 5, 2022

OS: Mac OS 11.6.5 (Intel x86-64)
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 function tools

Easily re-produced by creating new azure func app - http trigger, add package 'Microsoft.Data.Sqlite'.
Try to open a database:

[FunctionName("test")] public static async Task<IActionResult> RunAsync( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log)
` {

    log.LogInformation("C# HTTP trigger function processed a request.");
    using (var dbConn = new SqliteConnection("Data Source=database.db"))
    {

        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.

EDIT: Just tested in Linux PopOS 2110. Same issue occurs.

@cipherw0lf cipherw0lf added the bug label Apr 5, 2022
@v-bbalaiagar v-bbalaiagar self-assigned this Apr 11, 2022
@v-bbalaiagar
Copy link

Thank you for your feedback! We will check for the possibilities internally and update you with the findings.

@v-bbalaiagar
Copy link

Hi @rish501 , Here is a SO which addresses similar scenario and solutions to resolve it - https://stackoverflow.com/questions/43811731/unable-to-load-dll-e-sqlite3-the-specified-module-could-not-be-found/63713335#63713335
Related Information :
natemcmaster/DotNetCorePlugins#84

Please check and let us know if this helps.

@weber2up
Copy link

I also have this problem on Mac. Adding SQLitePCLRaw.bundle_e_sqlite3 doesn't help.

@cipherw0lf
Copy link
Author

Hi
None of the solutions above work.
As mentioned, the SQLite libraries work fine on console / asp.net projects on Mac and Linux.
The problem seems to occur when running in the Azure Functions tools environment in Mac/Linux.

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

No branches or pull requests

4 participants