-
Notifications
You must be signed in to change notification settings - Fork 479
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 'git2-ef5a385' or one of its dependencies #716
Comments
A Console Application works: docker run -it lambci/lambda:build-dotnetcore3.1 bash
|
Hi @boemekeld, Thanks for posting the issue! I tried to reproduce the issue on Mac OS Terminal. I was successfully able to invoke the Lambda function without any issues. I also see in the Lambda publish logs, the file libgit2-ef5a385.so is included in the output. Based on above testing, it appears that for certain environments, the file libgit2-ef5a385 is not found in the PATH and hence not copied to the output directory. There are multiple issues related to the native libgit2 library reported by users on GitHub libgit2sharp repository, including Issue 1703. It appears that it's may or may not be supported on some platforms and also mentions about it's dependency on OpenSSL. I also see a pull request 1714 which attempts to fix this issue for some platforms. So the issue doesn't appear to be related to Lambda environment, instead the platform used to deploy to AWS Lambda where libgit2 library not being included in publish process. As mentioned in the issue, the Lambda function works fine when published using Amazon Linux. I will give it a try on Windows 10 and let you know the outcome. Thanks, |
Hi @ashishdhingra, thanks for answering. I confirmed that the issues reported in the LibGit2Sharp repository are not related to this problem. The file libgit2-ef5a385.so is being included in the publish output. I also found a workaround: That is, I believe that the linux-x64 runtime libgit2-ef5a385.so is incompatible with AWS Linux. On the other hand, the rhel-x64 runtime works. At this point, I set up a Post-Publish script to replace the file:
Do you know a better way to solve this? |
Hi @boemekeld, Good to see that you were able to find the workaround. After your reply, I was about to propose the same workaround as you mentioned. I think this is the good workaround for the time being until further support for more platforms is added in the library or fix to remove dependency on native libraries is published (I do see there was some failing PR in libgit2sharp repository, not sure if that would provide permanent fix in future). Please let me if workaround implemented by you is good for now and confirm if we could close this issue. Thanks, |
Yes, thanks for your time. |
Description
I'm trying to use a library called GitLib2Sharp, but an error occurs when trying to load it.
I tried to reproduce this problem on an Amazon Linux EC2, but the error did not occur.
Reproduction Steps
dotnet new lambda.EmptyFunction --name LambdaGit
cd LambdaGit/src/LambdaGit
dotnet add package LibGit2Sharp --version 0.27.0-preview-0034
--- add "new LibGit2Sharp.Repository();" in "FunctionHandler" function in "Function.cs"
dotnet lambda deploy-function LambdaGit --function-role LambdaGitRole
dotnet lambda invoke-function LambdaGit --payload "LambdaOK"
Logs
Payload:
{
"errorType": "TypeInitializationException",
"errorMessage": "The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.",
"stackTrace": [
"at LibGit2Sharp.Core.NativeMethods.git_repository_new(git_repository*& repo)",
"at LibGit2Sharp.Core.Proxy.git_repository_new()",
"at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter)",
"at lambda_method(Closure , Stream , Stream , LambdaContextInternal )"
],
"cause": {
"errorType": "DllNotFoundException",
"errorMessage": "Unable to load shared library 'git2-ef5a385' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgit2-ef5a385: cannot open shared object file: No such file or directory",
"stackTrace": [
"at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()",
"at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary()",
"at LibGit2Sharp.Core.NativeMethods..cctor()"
]
}
}
Log Tail:
START RequestId: 0e940c07-4526-411d-9f47-ffbfc2cd3a73 Version: $LATEST
The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.: TypeInitializationException
at LibGit2Sharp.Core.NativeMethods.git_repository_new(git_repository*& repo)
at LibGit2Sharp.Core.Proxy.git_repository_new()
at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter)
at lambda_method(Closure , Stream , Stream , LambdaContextInternal )
at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary()
at LibGit2Sharp.Core.NativeMethods..cctor()
END RequestId: 0e940c07-4526-411d-9f47-ffbfc2cd3a73
REPORT RequestId: 0e940c07-4526-411d-9f47-ffbfc2cd3a73 Duration: 702.47 ms Billed Duration: 800 ms Memory Size: 256 MB Max Memory Used: 69 MB Init Duration: 156.11 ms
Environment
I analyzed several related issues in the GitLib2Sharp and Docker repositories but I was unable to solve this problem.
Please help me.
This is a 🐛 bug-report
The text was updated successfully, but these errors were encountered: