cargo xbuild pollutes source tree #6

Closed
opened 2020-05-07 14:42:27 +08:00 by sb10q · 2 comments

cargo xbuild does not completely take into account the --target-dir option and still uses the ./target folder for certain things.

src> ls                                                                                                                                   artiq-zynq-env 
armv7-none-eabihf.json  Cargo.lock  Cargo.toml  libdyld  Makefile  runtime  szl  zc706.py
src> cargo xbuild --release -p runtime --target-dir ../build/firmware                                                                     artiq-zynq-env 
                   
    Updating crates.io index
   [...]
    Finished release [optimized + debuginfo] target(s) in 0.06s
src> ls                                                                                                                                   artiq-zynq-env 
armv7-none-eabihf.json  Cargo.lock  Cargo.toml  libdyld  Makefile  runtime  szl  target  zc706.py
src> find target/                                                                                                                         artiq-zynq-env 
target/
target/sysroot
target/sysroot/lib
target/sysroot/lib/rustlib
target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu
target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/.sentinel
target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin
target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-size
target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata
target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objcopy
target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-nm
[...]

This target folder can cause the Nix build to fail (not finding the correct core crate).

``cargo xbuild`` does not completely take into account the ``--target-dir`` option and still uses the ``./target`` folder for certain things. ```text src> ls artiq-zynq-env armv7-none-eabihf.json Cargo.lock Cargo.toml libdyld Makefile runtime szl zc706.py src> cargo xbuild --release -p runtime --target-dir ../build/firmware artiq-zynq-env Updating crates.io index [...] Finished release [optimized + debuginfo] target(s) in 0.06s src> ls artiq-zynq-env armv7-none-eabihf.json Cargo.lock Cargo.toml libdyld Makefile runtime szl target zc706.py src> find target/ artiq-zynq-env target/ target/sysroot target/sysroot/lib target/sysroot/lib/rustlib target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/.sentinel target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-size target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objcopy target/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-nm [...] ``` This ``target`` folder can cause the Nix build to fail (not finding the correct core crate).
astro was assigned by sb10q 2020-05-07 14:50:54 +08:00

Setting an additional env XBUILD_SYSROOT_PATH=$(pwd)/../build/sysroot works around that. Seems to need an absolute path here.

Setting an additional env `XBUILD_SYSROOT_PATH=$(pwd)/../build/sysroot` works around that. Seems to need an absolute path here.
astro closed this issue 2020-05-09 06:28:50 +08:00
Poster
Owner

Okay, I'll update the Makefile

Okay, I'll update the Makefile
sb10q reopened this issue 2020-05-09 09:42:16 +08:00
sb10q closed this issue 2020-05-09 13:21:59 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/artiq-zynq#6
There is no content yet.