cross build --target-dir does not behave the same as cargo build --target-dir
jasonsewall opened this issue · 2 comments
Checklist
- I've looked through the issues and pull requests for similar reports
Describe your issue
cargo build --target-dir=<dir>
will use <dir>
instead of any target-specific prefix. So:
$ cargo build --target-dir=mytargets/linux-amd64 -q
$ ls mytargets/linux-amd64
CACHEDIR.TAG debug
$ ls mytargets/linux-amd64/debug
build deps examples incremental <my libs> <my exes>
cross
appears to do something quite different that I don't understand.
$ cross build --target-dir=mytargets/linux-arm64 --target=aarch64-unknown-linux-gnu -q
$ ls mytargets/linux-arm64
aarch64-unknown-linux-gnu CACHEDIR.TAG debug
$ ls mytargets/linux-arm64/debug
build deps examples incremental # nothing else
$ ls mytargets/linux-arm64/aarch64-unknown-linux-gnu
CACHEDIR.TAG debug
$ ls mytargets/linux-arm64/aarch64-unknown-linux-gnu/debug
build deps examples incremental <my libs> <my exes>
So it still creates the target dir of its choosing, just inside whatever target-dir I specify. Furthermore, it appears to copy some of the build artifacts (but not the final products) among /.
I'd expect this instead to work the way cargo does. This makes target-dir pretty unusable.
What target(s) are you cross-compiling for?
aarch64-unknown-linux-gnu
Which operating system is the host (e.g computer cross is on) running?
- macOS
- Windows
- Linux / BSD
- other OS (specify in description)
What architecture is the host?
- x86_64 / AMD64
- arm32
- arm64 (including Mac M1)
What container engine is cross using?
- docker
- podman
- other container engine (specify in description)
cross version
cross 0.2.5 (a599f20 2023-08-23)
Example
See the description.
Additional information / notes
No response
This might just be a symptom of cargo
itself exhibiting this behavior, upon further experimentation.
Yes, this is how cargo works, you'll get the same behaviour when using cargo build --target target --target-dir target-dir