From: Andy Koppe Date: Mon, 19 Oct 2026 19:43:24 GMT Subject: Re: [PATCH] Makefile: pin cargo --target-dir to ./target Message-ID: In-Reply-To: On Mon, 19 Oct 2026 at 17:07, Junio C Hamano wrote: > Andy Koppe writes: > > The Makefile assumes that cargo places build artifacts under ./target. > > That assumption breaks if the user has a custom target dir setting, e.g. > > in their ~/.cargo/config.toml file or in the CARGO_TARGET_DIR env var. > > This results in a link error due to failing to find the gitcore library > > built with cargo. > > > > To fix this, pass '--target-dir target' to the cargo commands that build > > gitcore. Add it directly to the recipes rather than to CARGO_ARGS, so > > that it isn't lost if CARGO_ARGS is overridden. > > The change might make sense, but these areas are touched by other > topics in flight. > > Given that they both appear on the same line as $(CARGO_ARGS) > appears, I have to wonder if we want to instead just add a single > > CARGO_ARGS += --target-dir target > > somewhere early that are unreleated to these individual rules? The problem I see with that approach is that CARGO_ARGS looks like it is intended for build preferences similar to CFLAGS or LDFLAGS that could be overridden on the make command line, whereas the target dir is a hard requirement of the subsequent link step. I suppose `override CARGO_ARGS += --target-dir target` would avoid that concern, but also set a trap because any subsequent modifications of the variable without `override` would be quietly ignored. The conflicting topic apparently is mh/rust-crate-subdir by Mike Hommey, which moves things into a 'rust' subdirectory, but is looking somewhat stalled: https://lore.kernel.org/git/20260917060415.2986259-1-mh@glandium.org/ I'd of course be happy to reapply the --target-dir tweak here on top of that if it does go ahead, or for Mike to just add it there. Andy