Open u9g opened 6 months ago
Can you run ilasm
from the command prompt?
Does your target folder contain a file ending in .il
?
doesn't look like it https://gist.github.com/u9g/79ffa3fec5a1999097b4ad9cff549733
PS C:\Users\myusername\Documents\code\rustc_codegen_clr> cd .\target\
PS C:\Users\myusername\Documents\code\rustc_codegen_clr\target> ls
Directory: C:\Users\myusername\Documents\code\rustc_codegen_clr\target
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 5/22/2024 4:14 PM debug
-a---- 5/22/2024 9:15 PM 1901 .rustc_info.json
-a---- 5/22/2024 12:35 PM 177 CACHEDIR.TAG
PS C:\Users\myusername\Documents\code\rustc_codegen_clr\target> cd .\debug\
PS C:\Users\myusername\Documents\code\rustc_codegen_clr\target\debug> ls
Directory: C:\Users\myusername\Documents\code\rustc_codegen_clr\target\debug
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 5/22/2024 4:13 PM .fingerprint
d----- 5/22/2024 12:35 PM build
d----- 5/22/2024 4:14 PM deps
d----- 5/22/2024 12:35 PM examples
d----- 5/22/2024 4:13 PM incremental
-a---- 5/22/2024 12:35 PM 0 .cargo-lock
-a---- 5/22/2024 4:13 PM 4205 librustc_codegen_clr.d
-a---- 5/22/2024 4:14 PM 862147402 librustc_codegen_clr.rlib
-a---- 5/22/2024 4:13 PM 4630 linker.d
-a---- 5/22/2024 4:14 PM 1499648 linker.exe
-a---- 5/22/2024 4:14 PM 24596480 linker.pdb
-a---- 5/22/2024 4:13 PM 4201 rustc_codegen_clr.d
-a---- 5/22/2024 4:14 PM 2833408 rustc_codegen_clr.dll
-a---- 5/22/2024 4:14 PM 935 rustc_codegen_clr.dll.exp
-a---- 5/22/2024 4:13 PM 1978 rustc_codegen_clr.dll.lib
-a---- 5/22/2024 4:14 PM 29446144 rustc_codegen_clr.pdb
-a---- 5/22/2024 4:13 PM 4262 rustflags.d
-a---- 5/22/2024 4:14 PM 89088 rustflags.exe
-a---- 5/22/2024 4:14 PM 18010112 rustflags.pdb
Could you try running cargo run --bin rustflags
using the newest commit? It should check if the codegen can use ilasm
.
Besides that, the .il
file should be somewhere in the target
directory of the crate you are building, not within the target
directory of rustc_codegen_clr
. Could you search for the .il
file there?
Hm, I just installed ilasm
PS C:\Users\myusername\Documents\code\rustc_codegen_clr> cargo run --bin rustflags
warning: unused imports: `BinOp` and `Operand`
|
13 | use rustc_middle::mir::{BinOp, Operand};
| ^^^^^ ^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: `rustc_codegen_clr` (lib) generated 1 warning (run `cargo fix --lib -p rustc_codegen_clr` to apply 1 suggestion)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
Running `target\debug\rustflags.exe`
Welcome to the `rustc_codegen_clr` environment setup helper!
This tool will help you use the codegen to compile Rust projects.
Doing dependency checks...
thread 'main' panicked at src\bin\rustflags.rs:4:19:
Could not find the CIL assembler at name/path "ilasm", due to Error { kind: NotFound, message: "program not found" }.
Please instal the CIL assembler, and/or set the ILASM_PATH enviroment variable to point to your CIL assembler.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\rustflags.exe` (exit code: 101)
PS C:\Users\myusername\Documents\code\rustc_codegen_clr> cargo run --bin rustflags
warning: unused imports: `BinOp` and `Operand`
--> src\binop\checked\mod.rs:13:25
|
13 | use rustc_middle::mir::{BinOp, Operand};
| ^^^^^ ^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: `rustc_codegen_clr` (lib) generated 1 warning (run `cargo fix --lib -p rustc_codegen_clr` to apply 1 suggestion)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s
Running `target\debug\rustflags.exe`
Welcome to the `rustc_codegen_clr` environment setup helper!
This tool will help you use the codegen to compile Rust projects.
Doing dependency checks...
An CIL assembler has been detected.
Dependency checks succeded.
WARNING: Please note, the project is currently in the early stages of development. Bugs, crashes and miscompilations will occur.
Currently, there is no way to permanently install the codegen. It is enabled on a per-shell-session basis (enabled for your particular command prompt window).
In order to compile cargo crates with `rustc_codegen_clr`, please set the RUSTFLAGS environment variable to:
"-Z codegen-backend=\\?\C:\Users\myusername\Documents\code\rustc_codegen_clr\target\debug\rustc_codegen_clr.dll -C linker=\\?\C:\Users\myusername\Documents\code\rustc_codegen_clr\target\debug\linker.exe -C link-args=--cargo-support "
You may use the following command to quickly set the required environment variables:
$Env:RUSTFLAGS = '-Z codegen-backend=\\?\C:\Users\myusername\Documents\code\rustc_codegen_clr\target\debug\rustc_codegen_clr.dll -C linker=\\?\C:\Users\myusername\Documents\code\rustc_codegen_clr\target\debug\linker.exe -C link-args=--cargo-support '
After you are done working with `rustc_codegen_clr` either unset the environment variable OR restart your shell (close the command prompt window).
Please note that those variables may change when the codegen is updated/rebuilt.
After each time the codegen is rebuilt, please use this tool again to get updated build environment variables.
If you are using the project, please remember to:
1. Update BOTH rustc and the project on a regular basis.
2. Report compiler bugs to the maintainers of `rustc_codegen_clr`, and not the maintainers of the Rust compiler as a whole.
In 99.999% of the cases, the bug is within this project and not the Rust compiler.
Looks like it detected ilasm
but still has the same problem
Looks like there aren't any .il files either.
The newest version of the project should (hopefully) fix the issue.
If the issue still persists, could you try running the linker manually (by going to the cilly
directory, and running cargo run
)?
Describe the bug Latest commit fails to compile example in QUICKSTART.md,
error:
Example of miscompiled code
Expected behavior It should run normally.
Info about your system (please complete the following information):
Additional context None