小编Bru*_*ian的帖子

如何在 Cargo 中使用相对 git 子模块路径?

我已经为 Rust 完成了一个 MuPDF 绑定,我想将它作为一个板条箱从它的 git 存储库中导入。

我的 Cargo.toml 文件是这样的:

[package]
name = "package_name"
version = "0.1.0"
authors = ["me"]

[dependencies]
mupdf-sys = {git = "https://github.com/bruno-sm/mupdf-sys.git"}
Run Code Online (Sandbox Code Playgroud)

问题在于 MuPDF 将其第三方库存储为具有相对路径的 git 子模块。这是 .gitmodules 文件的摘录:

[package]
name = "package_name"
version = "0.1.0"
authors = ["me"]

[dependencies]
mupdf-sys = {git = "https://github.com/bruno-sm/mupdf-sys.git"}
Run Code Online (Sandbox Code Playgroud)

当我运行时cargo build出现以下错误

[submodule "thirdparty/jbig2dec"]
    path = thirdparty/jbig2dec
    url = ../jbig2dec.git
[submodule "thirdparty/mujs"]
    path = thirdparty/mujs
    url = ../mujs.git
Run Code Online (Sandbox Code Playgroud)

这表明未指定 MuPDF 存储库的基本 URL,但它在文件中 .git/modules/mupdf/config

Updating git repository `https://github.com/bruno-sm/mupdf-sys`
error: failed …
Run Code Online (Sandbox Code Playgroud)

git git-submodules rust rust-cargo

6
推荐指数
1
解决办法
1826
查看次数

标签 统计

git ×1

git-submodules ×1

rust ×1

rust-cargo ×1