tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] Cargo build product directory: CARGO_TARGET_DIR



> Date: Thu, 6 Feb 2025 15:31:52 +0100
> From: Thomas Klausner <wiz%NetBSD.org@localhost>
> 
> ===> Installing for ast-grep-0.34.4
> => Generating pre-install file lists
> error: found a virtual manifest at `/scratch/devel/ast-grep/work/ast-grep-0.34.4/Cargo.toml` instead of a package manifest
> *** Error code 101
> 
> The code in lang/rust/cargo.mk basically expands to:
> 
> cd ${WRKSRC} && /usr/pkg/bin/cargo install --path . --root /scratch/devel/ast-grep/work/.destdir/usr/pkg --offline -j16
> 
> Does anyone know what this error wants to tell us, and how to get
> around it?

It's a common issue -- for some reason while you can do recursive
`cargo build' there's no recursive `cargo install':

https://github.com/rust-lang/cargo/issues/4101
https://github.com/rust-lang/cargo/issues/7124
https://github.com/rust-lang/cargo/issues/7599
https://github.com/rust-lang/cargo/issues/7194
https://users.rust-lang.org/t/cargo-install-workspace/29145
https://stackoverflow.com/questions/61189179/found-a-virtual-manifest-at-path-instead-of-a-package-manifest

So the package needs to either:

(a) install the files manually, or
(b) explicitly specify all the sub-crates with `--path' instead of
    using `--path .'.

The latter requires a slightly more invasive change -- and I'd like to
hold that off until the cross-build patch is merged, because changing
the `--path' arguments will cause more merge conflicts to resolve and
test.

> Even if we don't find a fix this, I think if we add a variable
> CARGO_BINARIES and add a rule in cargo.mk to install the files listed
> in it manually (with basically the do-install from your mail above),
> we can limit the scope of the variable you want to introduce to that
> file.

Fine by me but the cargo.mk change to define CARGO_TARGET_DIR will
still be needed for that!


Home | Main Index | Thread Index | Old Index