Open cptpiepmatz opened 1 week ago
Recently, there were some changes to the way librustcdriver.so
is linked against the codegen, which prevented me from using anything in src/bin
.
I have ported most of my utilities to use cargo scripts, but rustflags
was not ported yet - it is now. The docs should also reflect this change now.
Thanks, that makes it clear, but the script doesn't seem to work for me:
❯ ./bin/rustflags.rs
warning: `package.edition` is unspecified, defaulting to `2021`
Compiling rustflags v0.0.0 (/home/piet/projects/rustc_codegen_clr/bin)
error[E0583]: file not found for module `build_backend`
--> rustflags.rs:2:1
|
2 | mod build_backend;
| ^^^^^^^^^^^^^^^^^^
|
= help: to create the module `build_backend`, create file "build_backend.rs" or "build_backend/mod.rs"
= note: if there is a `mod build_backend` elsewhere in the crate already, import it with `use crate::...` instead
error[E0432]: unresolved import `crate::build_backend::ilasm_check`
--> rustflags.rs:3:5
|
3 | use crate::build_backend::ilasm_check;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ilasm_check` in `build_backend`
error[E0425]: cannot find function `cargo_build_env` in module `crate::build_backend`
--> rustflags.rs:5:43
|
5 | let build_env = crate::build_backend::cargo_build_env();
| ^^^^^^^^^^^^^^^ not found in `crate::build_backend`
Some errors have detailed explanations: E0425, E0432, E0583.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `rustflags` (bin "rustflags") due to 3 previous errors
Thanks, that makes it clear, but the script doesn't seem to work for me:
❯ ./bin/rustflags.rs warning: `package.edition` is unspecified, defaulting to `2021` Compiling rustflags v0.0.0 (/home/piet/projects/rustc_codegen_clr/bin) error[E0583]: file not found for module `build_backend` --> rustflags.rs:2:1 | 2 | mod build_backend; | ^^^^^^^^^^^^^^^^^^ | = help: to create the module `build_backend`, create file "build_backend.rs" or "build_backend/mod.rs" = note: if there is a `mod build_backend` elsewhere in the crate already, import it with `use crate::...` instead error[E0432]: unresolved import `crate::build_backend::ilasm_check` --> rustflags.rs:3:5 | 3 | use crate::build_backend::ilasm_check; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ilasm_check` in `build_backend` error[E0425]: cannot find function `cargo_build_env` in module `crate::build_backend` --> rustflags.rs:5:43 | 5 | let build_env = crate::build_backend::cargo_build_env(); | ^^^^^^^^^^^^^^^ not found in `crate::build_backend` Some errors have detailed explanations: E0425, E0432, E0583. For more information about an error, try `rustc --explain E0425`. error: could not compile `rustflags` (bin "rustflags") due to 3 previous errors
I forgot to include one of the files(
build_backend.rs
). Should be fixed now.
Running the script inside bin
works now fine for me, but it seems your script depends where you run it, so running it in root doesn't work:
❯ ./bin/rustflags.rs
warning: `package.edition` is unspecified, defaulting to `2021`
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
Running `/home/piet/.cargo/target/3e/587f9e7664f3c4/debug/rustflags`
thread 'main' panicked at build_backend.rs:194:10:
could not build the backend: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Hey 👋, I just wanted to compile the project after a fresh clone. The quickstart guide suggested running
cargo run --bin rustflags
but that doesn't work for me, as Cargo is not able to find the binaries. I checked the docs on this and I think the binaries are in an incorrect location. According to the docs it should be insrc/bin
or defined in the Cargo.toml. Am I doing something wrong here?