Hi all,
I am trying to understand how cargo invokes rustc, and what it exactly does when I type "cargo build"...
So, I created a new project with "cargo new hello", I did "cd hello", and then I typed "cargo build -vv". It said:
luca@luca64:/tmp/Test/hello$ cargo build -vv
Compiling hello v0.1.0 (/tmp/Test/hello)
Running `CARGO_PKG_HOMEPAGE= CARGO_PKG_REPOSITORY= CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_NAME=hello CARGO_PKG_VERSION=0.1.0 CARGO_PKG_AUTHORS='lucabe72@gmail.com' CARGO=/usr/bin/cargo CARGO_MANIFEST_DIR=/tmp/Test/hello CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PRIMARY_PACKAGE=1 CARGO_PKG_VERSION_PRE= LD_LIBRARY_PATH='/tmp/Test/hello/target/debug/deps:/usr/lib' CARGO_PKG_DESCRIPTION= rustc --edition=2018 --crate-name hello src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=24a97ba19af841c7 -C extra-filename=-24a97ba19af841c7 --out-dir /tmp/Test/hello/target/debug/deps -C incremental=/tmp/Test/hello/target/debug/incremental -L dependency=/tmp/Test/hello/target/debug/deps`
Finished dev [unoptimized + debuginfo] target(s) in 0.32s
and it generated the "target/debug/hello" executable.
However, if I do "rm -rf target" and then I type
CARGO_PKG_HOMEPAGE= CARGO_PKG_REPOSITORY= CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_NAME=hello CARGO_PKG_VERSION=0.1.0 CARGO_PKG_AUTHORS='lucabe72@gmail.com' CARGO=/usr/bin/cargo CARGO_MANIFEST_DIR=/tmp/Test/hello CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PRIMARY_PACKAGE=1 CARGO_PKG_VERSION_PRE= LD_LIBRARY_PATH='/tmp/Test/hello/target/debug/deps:/usr/lib' CARGO_PKG_DESCRIPTION= rustc --edition=2018 --crate-name hello src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=24a97ba19af841c7 -C extra-filename=-24a97ba19af841c7 --out-dir /tmp/Test/hello/target/debug/deps -C incremental=/tmp/Test/hello/target/debug/incremental -L dependency=/tmp/Test/hello/target/debug/deps
I get an error:
error: error writing dependencies to `/tmp/Test/hello/target/debug/deps/hello-24a97ba19af841c7.d`: No such file or directory (os error 2)
error: aborting due to previous error
and the name of the generated executable is not "target/debug/hello"... So, cargo obviously did something more than what it declared when I asked "build -vv"... Does anyone know if it is possible to see exactly what cargo does when building my project?
Thanks,
Luca