libgit2 / libgit2/libgit2sharp
dotnet/source-build: Unable to load shared library 'git2-8e0b172'
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 3.5k
- 派生
- 925
- PR 合并指标
- 30 天内没有已合并 PR
描述
I am working on a Dotnet package for Exherbo Linux.
Following the error message below, I realized that there were several libraries libgit2-8e0b172.so
s0dy ~/source-build (release/3.0) find . -name libgit2-8e0b172.so
./packages/libgit2sharp.nativebinaries/1.0.235/runtimes/debian.9-x64/native/libgit2-8e0b172.so
./packages/libgit2sharp.nativebinaries/1.0.235/runtimes/fedora-x64/native/libgit2-8e0b172.so
./packages/libgit2sharp.nativebinaries/1.0.235/runtimes/alpine-x64/native/libgit2-8e0b172.so
./packages/libgit2sharp.nativebinaries/1.0.235/runtimes/linux-x64/native/libgit2-8e0b172.so
./packages/libgit2sharp.nativebinaries/1.0.235/runtimes/rhel-x64/native/libgit2-8e0b172.so
I also noticed that the lib for debian and fedora was related to openssl-1.1
s0dy ~/source-build (release/3.0) lddtree packages/libgit2sharp.nativebinaries/1.0.235/runtimes/debian.9-x64/native/libgit2-8e0b172.so
libgit2-8e0b172.so => packages/libgit2sharp.nativebinaries/1.0.235/runtimes/debian.9-x64/native/libgit2-8e0b172.so (interpreter => none)
librt.so.1 => /usr/host/lib/librt.so.1
libpthread.so.0 => /usr/host/lib/libpthread.so.0
ld-linux-x86-64.so.2 => /usr/host/lib/ld-linux-x86-64.so.2
libcurl.so.4 => /usr/host/lib/libcurl.so.4
libssh2.so.1 => /usr/x86_64-pc-linux-gnu/lib/libssh2.so.1
libssl.so.1.1 => /usr/host/lib/libssl.so.1.1
libcrypto.so.1.1 => /usr/host/lib/libcrypto.so.1.1
libdl.so.2 => /usr/host/lib/libdl.so.2
libz.so.1 => /usr/host/lib/libz.so.1
libc.so.6 => /usr/host/lib/libc.so.6
While the others (alpine, linux and rhel) are related to openssl-1.0
s0dy ~/source-build (release/3.0) lddtree packages/libgit2sharp.nativebinaries/1.0.235/runtimes/alpine-x64/native/libgit2-8e0b172.so
libgit2-8e0b172.so => packages/libgit2sharp.nativebinaries/1.0.235/runtimes/alpine-x64/native/libgit2-8e0b172.so (interpreter => none)
libcurl.so.4 => /usr/host/lib/libcurl.so.4
libssh2.so.1 => /usr/x86_64-pc-linux-gnu/lib/libssh2.so.1
libssl.so.1.1 => /usr/x86_64-pc-linux-gnu/lib/libssl.so.1.1
libcrypto.so.1.1 => /usr/x86_64-pc-linux-gnu/lib/libcrypto.so.1.1
libdl.so.2 => /usr/host/lib/libdl.so.2
ld-linux-x86-64.so.2 => /usr/host/lib/ld-linux-x86-64.so.2
libpthread.so.0 => /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
libc.so.6 => /usr/x86_64-pc-linux-gnu/lib/libc.so.6
libssl.so.1.0.0 => not found
libcrypto.so.1.0.0 => not found
libz.so.1 => /usr/host/lib/libz.so.1
libc.musl-x86_64.so.1 => not found
-
The version of my distribution is not recognized, I guess I use the linux-x64 version that is related to openssl-1.0. So I have libssl and libcrypto that are not found as you can see above.
-
I tried replacing my /etc/os-release file with that of a debian machine and it works.
-
I would like to find a solution, make a patch. Which file exactly checks the distribution? How to tell him to use the good library related to openssl-1.1?
Reproduction steps
- git clone https://github.com/dotnet/source-build.git
- cd source-build.git
- ./build.sh
Expected behavior
successful compilation ?
Actual behavior
fail: Microsoft.DotNet.Darc.Operations.Operation[0]
Something failed while cloning.
System.Exception: Something went wrong when cloning repo https://github.com/dotnet/arcade at <default branch> into /home/s0dy/source-build/bin/src/arcade ---> System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'git2-8e0b172' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgit2-8e0b172: cannot open shared object file: No such file or directory
at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
at LibGit2Sharp.Core.NativeMethods.LoadNativeLibrary() in C:\projects\libgit2sharp\LibGit2Sharp\Core\NativeMethods.cs:line 47
at LibGit2Sharp.Core.NativeMethods..cctor() in C:\projects\libgit2sharp\LibGit2Sharp\Core\NativeMethods.cs:line 37
--- End of inner exception stack trace ---
at LibGit2Sharp.Core.NativeMethods.git_clone(git_repository*& repo, String origin_url, FilePath workdir_path, GitCloneOptions& opts)
at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 354
at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options) in C:\projects\libgit2sharp\LibGit2Sharp\Repository.cs:line 715
at Microsoft.DotNet.DarcLib.RemoteRepoBase.Clone(String repoUri, String commit, String targetDirectory, ILogger _logger, String pat, String gitDirectory) in /home/s0dy/source-build/tools-local/arcade-services/src/Microsoft.DotNet.Darc/src/DarcLib/RemoteRepoBase.cs:line 176
--- End of inner exception stack trace ---
at Microsoft.DotNet.DarcLib.RemoteRepoBase.Clone(String repoUri, String commit, String targetDirectory, ILogger _logger, String pat, String gitDirectory) in /home/s0dy/source-build/tools-local/arcade-services/src/Microsoft.DotNet.Darc/src/DarcLib/RemoteRepoBase.cs:line 210
at Microsoft.DotNet.DarcLib.GitHubClient.Clone(String repoUri, String commit, String targetDirectory, String gitDirectory) in /home/s0dy/source-build/tools-local/arcade-services/src/Microsoft.DotNet.Darc/src/DarcLib/GitHubClient.cs:line 875
at Microsoft.DotNet.Darc.Operations.CloneOperation.HandleMasterCopyAndCreateGitDir(RemoteFactory remoteFactory, String repoUrl, String masterGitRepoPath, String masterRepoGitDirPath, String gitDirRedirect, ILogger log) in /home/s0dy/source-build/tools-local/arcade-services/src/Microsoft.DotNet.Darc/src/Darc/Operations/CloneOperation.cs:line 282
at Microsoft.DotNet.Darc.Operations.CloneOperation.HandleMasterCopyWithGitDirPath(RemoteFactory remoteFactory, String repoUrl, String masterGitRepoPath, String masterRepoGitDirPath, ILogger log) in /home/s0dy/source-build/tools-local/arcade-services/src/Microsoft.DotNet.Darc/src/Darc/Operations/CloneOperation.cs:line 270
at Microsoft.DotNet.Darc.Operations.CloneOperation.HandleMasterCopy(RemoteFactory remoteFactory, String repoUrl, String masterGitRepoPath, String masterRepoGitDirPath, ILogger log) in /home/s0dy/source-build/tools-local/arcade-services/src/Microsoft.DotNet.Darc/src/Darc/Operations/CloneOperation.cs:line 225
at Microsoft.DotNet.Darc.Operations.CloneOperation.ExecuteAsync() in /home/s0dy/source-build/tools-local/arcade-services/src/Microsoft.DotNet.Darc/src/Darc/Operations/CloneOperation.cs:line 102
/home/s0dy/source-build/tools-local/init-build.proj(169,5): error MSB3073: The command "/home/s0dy/source-build/Tools/dotnetcli/dotnet /home/s0dy/source-build/tools-local/arcade-services/artifacts/bin/Microsoft.DotNet.Darc/Release/netcoreapp2.1/Microsoft.DotNet.Darc.dll clone --repos-folder /home/s0dy/source-build/bin/src/ --git-dir-folder /home/s0dy/source-build/.git/modules/src/ --include-toolset --ignore-repos ";https://dev.azure.com/dnceng/internal/_git/dotnet-optimization;https://dev.azure.com/devdiv/DevDiv/_git/DotNet-Trusted;https://devdiv.visualstudio.com/DevDiv/_git/DotNet-Trusted;https://dnceng@dev.azure.com/dnceng/internal/_git/dotnet-optimization;https://dev.azure.com/dnceng/internal/_git/dotnet-core-setup" --azdev-pat bogus --github-pat bogus --depth 0 --debug" exited with code 42.
Version of LibGit2Sharp (release number or SHA1)
Versions pulled from NuGet package
LibGit2Sharp.NativeBinaries - version="1.0.235"
Operating system(s) tested; .NET runtime tested
Exherbo Linux trying to compile dotnet/source-build release/3.0
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 LibGit2Sharp/Core/NativeMethods.cs 开始,重点检查 stack trace 中引用的 LoadNativeLibrary() 路径,并检查 packages/libgit2sharp.nativebinaries/1.0.235/runtimes/ 下的原生资源。在 Exherbo Linux 上使用 ./build.sh 重现问题,并比较基于 /etc/os-release 的发行版检测。完成的标准是:在 source-build 的 clone 操作期间,能够加载适当的 OpenSSL 兼容的原生 libgit2 库。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, git, linux
- 领域
- devtools, operating-systems
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 30/100