libgit2 / libgit2/libgit2sharp

dotnet/source-build: Unable to load shared library 'git2-8e0b172'

未關閉
#1,690 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 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
  1. git clone https://github.com/dotnet/source-build.git
  2. cd source-build.git
  3. ./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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 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

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。