`libgit2` found for linking, but not loading (i.e. missing `rpath`).

オープン
#1,138 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
rust
領域
build-system

調査の方向性

libgit2-sys の build script とその pkg-config の処理から始め、build script の実行時に依存関係がどのように読み込まれるかを追跡します。issue に記載されている利用可能な rpath と vendored-version のオプションを比較します。Homebrew でインストールした libgit2 を RUSTFLAGS を手動で設定せずに使用できるか、読み込めない場合に vendored バージョンが選択されれば、done とします。

索引モデルが issue の本文から書いたものです。

説明

I have a build script using git2, which builds fine, but when it is executed, fails with:

/target/debug/build/built2-42d7a0628db36d4d/build-script-build: error while loading shared libraries: libgit2.so.1.9: cannot open shared object file: No such file or directory

The problem is libgit2.so.1.9 is found in /home/linuxbrew/.linuxbrew/Cellar/libgit2/1.9.0/lib/libgit2.so.1.9 (via Homebrew-installed pkg-config), but when executing cannot find it since it is not in the load path.

Ideally, the libgit2-sys build script should add that directory as rpath, but cargo has no way of forwarding this to a dependent binary (yet) using e.g. cargo:rustc-link-arg.

For normal binaries, you can hack the rpath into build.rs, but there is no way to set it for the build.rs itself other than setting RUSTFLAGS manually.

Maybe there is a way to detect when a package is found with pkg-config but cannot actually be loaded (e.g. using ldconfig -p) and fall back to using the vendored version in that case.

主要言語
Rust
スター
2.1k
フォーク
470
平均マージ
2日 17時間
マージ済み PR(30日)
18

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-lang/git2-rs のほかの issue

rust-lang/git2-rs の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。