Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error[E0425]: cannot find function f128_support_lib in module libc_fns when building under Windows 10 #54

Open
1Tiphereth opened this issue Sep 12, 2024 · 60 comments

Comments

@1Tiphereth
Copy link

Upon trying to build --all under Windows 10 22H2 via cargo +nightly build --all the build process encounters the error error[E0425]: cannot find function "f128_support_lib" in module "libc_fns"

PS C:\Users\gab\rustc_codegen_clr> cargo +nightly build --all
warning: C:\Users\gab\rustc_codegen_clr\Cargo.toml: unused manifest key: profile.dev.oom
warning: C:\Users\gab\rustc_codegen_clr\Cargo.toml: unused manifest key: profile.release.oom
warning: unused import: `std::path::PathBuf`
 --> cilly\src\libc_fns.rs:1:5
  |
1 | use std::path::PathBuf;
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `tpe`
   --> cilly\src\v2\cilroot.rs:151:40
    |
151 |             CILRoot::CpObj { src, dst, tpe } => [src, dst].into(),
    |                                        ^^^ help: try ignoring the field: `tpe: _`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: variable does not need to be mutable
   --> cilly\src\v2\il_exporter\mod.rs:186:21
    |
186 |                 let mut is_in_multiblock_handler = false;
    |                     ----^^^^^^^^^^^^^^^^^^^^^^^^
    |                     |
    |                     help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

warning: unused variable: `tpe`
  --> cilly\src\v2\iter.rs:92:62
   |
92 |                 CILIterElem::Root(CILRoot::CpObj { src, dst, tpe }) => match idx {
   |                                                              ^^^ help: try ignoring the field: `tpe: _`

warning: `cilly` (lib) generated 4 warnings (run `cargo fix --lib -p cilly` to apply 2 suggestions)
   Compiling cilly v0.1.1 (C:\Users\gab\rustc_codegen_clr\cilly)
warning: type `SystemThreadingTasks_TaskDebugView` should have an upper camel case name
    --> mycorrhiza\src\bindings.rs:6773:22
     |
6773 |             pub type SystemThreadingTasks_TaskDebugView =
     |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `SystemThreadingTasksTaskDebugView`
     |
     = note: `#[warn(non_camel_case_types)]` on by default

warning: unused import: `std::ptr::null`
 --> mycorrhiza\src\intrinsics.rs:1:5
  |
1 | use std::ptr::null;
  |     ^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: `mycorrhiza` (lib) generated 2 warnings (run `cargo fix --lib -p mycorrhiza` to apply 1 suggestion)
warning: unused import: `core::f16`
 --> src\constant.rs:1:5
  |
1 | use core::f16;
  |     ^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `call`
 --> src\constant.rs:6:5
  |
6 |     call,
  |     ^^^^

warning: unused import: `sub`
 --> src\terminator\intrinsics\utilis.rs:5:5
  |
5 |     sub,
  |     ^^^

warning: `rustc_codegen_clr` (lib) generated 3 warnings (run `cargo fix --lib -p rustc_codegen_clr` to apply 3 suggestions)
error[E0425]: cannot find function `f128_support_lib` in module `libc_fns`
   --> cilly\src\bin\linker\main.rs:191:43
    |
191 |     if let Some(f128_support) = libc_fns::f128_support_lib() {
    |                                           ^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `f128_support`
    |
   ::: C:\Users\gab\rustc_codegen_clr\cilly\src\libc_fns.rs:701:1
    |
701 | pub fn f128_support() -> Option<String> {
    | --------------------------------------- similarly named function `f128_support` defined here
    |
note: found an item that was configured out
   --> C:\Users\gab\rustc_codegen_clr\cilly\src\libc_fns.rs:683:8
    |
683 | pub fn f128_support_lib() -> Option<PathBuf> {
    |        ^^^^^^^^^^^^^^^^
note: the item is gated here
   --> C:\Users\gab\rustc_codegen_clr\cilly\src\libc_fns.rs:681:1
    |
681 | #[cfg(all(target_os = "linux", target_env = "gnu"))]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused variable: `file_path`
   --> cilly\src\bin\linker\native_passtrough.rs:127:19
    |
127 | pub fn add_shared(file_path: &str, native_pastrough: &mut NativePastroughInfo) {
    |                   ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_path`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `native_pastrough`
   --> cilly\src\bin\linker\native_passtrough.rs:127:36
    |
127 | pub fn add_shared(file_path: &str, native_pastrough: &mut NativePastroughInfo) {
    |                                    ^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_native_pastrough`

For more information about this error, try `rustc --explain E0425`.
warning: `cilly` (bin "linker") generated 2 warnings
error: could not compile `cilly` (bin "linker") due to 1 previous error; 2 warnings emitted
PS C:\Users\gab\rustc_codegen_clr> dotnet --info
.NET SDK:
 Version:           8.0.202
 Commit:            25674bb2f4
 Workload version:  8.0.200-manifests.8cf8de6d

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.202\

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      8.0.3
  Architecture: x64
  Commit:       9f4b1f5d66

.NET SDKs installed:
  8.0.202 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.28 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download```
@1Tiphereth
Copy link
Author

It should be said it still fails even without the +nightly flag

@FractalFir
Copy link
Owner

Should be fixed in the newest commit.

@1Tiphereth
Copy link
Author

As of the latest commit the f128 issue is not yet fully solved here is the full log, also it should be noted this is using a slightly older nightly version as the latest one cannot be installed due to file conflicts:

PS C:\Users\gab\rustc_codegen_clr> cargo +nightly-2024-09-11-x86_64-pc-windows-msvc build --all --release
warning: C:\Users\gab\rustc_codegen_clr\Cargo.toml: unused manifest key: profile.dev.oom
warning: C:\Users\gab\rustc_codegen_clr\Cargo.toml: unused manifest key: profile.release.oom
warning: unused import: `std::path::PathBuf`
 --> cilly\src\libc_fns.rs:1:5
  |
1 | use std::path::PathBuf;
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `crate::IString`
 --> cilly\src\v2\class.rs:5:5
  |
5 | use crate::IString;
  |     ^^^^^^^^^^^^^^

warning: unused import: `simplify_handlers::simplify_bbs`
 --> cilly\src\v2\opt\mod.rs:2:5
  |
2 | use simplify_handlers::simplify_bbs;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: variable does not need to be mutable
   --> cilly\src\v2\il_exporter\mod.rs:186:21
    |
186 |                 let mut is_in_multiblock_handler = false;
    |                     ----^^^^^^^^^^^^^^^^^^^^^^^^
    |                     |
    |                     help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

warning: `cilly` (lib) generated 4 warnings (run `cargo fix --lib -p cilly` to apply 4 suggestions)
   Compiling cilly v0.1.1 (C:\Users\gab\rustc_codegen_clr\cilly)
warning: unused import: `core::f16`
 --> src\constant.rs:1:5
  |
1 | use core::f16;
  |     ^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `call`
 --> src\constant.rs:6:5
  |
6 |     call,
  |     ^^^^

warning: `rustc_codegen_clr` (lib) generated 2 warnings (run `cargo fix --lib -p rustc_codegen_clr` to apply 2 suggestions)
error[E0599]: no method named `to_str` found for struct `String` in the current scope
   --> cilly\src\bin\linker\main.rs:191:41
    |
191 |         let f128_support = f128_support.to_str().to_owned().unwrap();
    |                                         ^^^^^^
    |
help: there is a method `to_string` with a similar name
    |
191 |         let f128_support = f128_support.to_string().to_owned().unwrap();
    |                                         ~~~~~~~~~

warning: unused variable: `file_path`
   --> cilly\src\bin\linker\native_passtrough.rs:127:19
    |
127 | pub fn add_shared(file_path: &str, native_pastrough: &mut NativePastroughInfo) {
    |                   ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_path`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `native_pastrough`
   --> cilly\src\bin\linker\native_passtrough.rs:127:36
    |
127 | pub fn add_shared(file_path: &str, native_pastrough: &mut NativePastroughInfo) {
    |                                    ^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_native_pastrough`

For more information about this error, try `rustc --explain E0599`.
warning: `cilly` (bin "linker") generated 2 warnings
error: could not compile `cilly` (bin "linker") due to 1 previous error; 2 warnings emitted
warning: build failed, waiting for other jobs to finish...```

@1Tiphereth
Copy link
Author

Ok so changing it to to_string and removing the unwrap does make it compile, although trying to use the dll afterwards still fails to compile the project with error of error: could not compile "compiler_builtins" (lib)

PS C:\Users\gab\Desktop\AngelaIfSheWasGood> cargo +nightly-2024-09-11-x86_64-pc-windows-msvc build
    Updating crates.io index
  Downloaded cfg-if v1.0.0
  Downloaded hashbrown v0.14.5
  Downloaded getopts v0.2.21
  Downloaded allocator-api2 v0.2.18
  Downloaded compiler_builtins v0.1.123
  Downloaded unicode-width v0.1.13
  Downloaded 6 crates (881.1 KB) in 0.48s
   Compiling compiler_builtins v0.1.123
   Compiling core v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core)
   Compiling std v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std)
   Compiling windows-targets v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\windows_targets)
   Compiling rustc-std-workspace-core v1.99.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-core)
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARINING: can't checked mul type i128
WARINING: can't checked mul type u128
WARINING: can't checked mul type i128
WARINING: can't checked mul type i128
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARNING: argument debug info count invalid(Too few). Expected 4, got 3. fn name:_ZN4core3ops8function5FnMut8call_mut17h1f55573bb893e4b6E
   Compiling alloc v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc)
   Compiling cfg-if v1.0.0
   Compiling unwind v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\unwind)
   Compiling rustc-demangle v0.1.24
WARNING: argument debug info count invalid(Too few). Expected 4, got 3. fn name:_ZN4core3ops8function6FnOnce9call_once17he164b2d0777a1bbcE
WARNING: argument debug info count invalid(Too few). Expected 4, got 3. fn name:_ZN4core3ops8function6FnOnce9call_once17h9dc955fb6cda7d7aE
WARNING: argument debug info count invalid(Too few). Expected 4, got 3. fn name:_ZN4core3ops8function6FnOnce9call_once17h57c010c954f749cfE
WARNING: argument debug info count invalid(Too few). Expected 4, got 3. fn name:_ZN4core3ops8function6FnOnce9call_once17h9bae6d288fc10f44E
Inline assembly is not yet supported!
thread 'rustc' panicked at src\binop\cmp.rs:79:14:
Can't eq type  f16
stack backtrace:
   0:     0x7ffa9876df91 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffa9876df91 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffa9876df91 - std::sys::backtrace::_print_fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:66
   3:     0x7ffa9876df91 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:39
   4:     0x7ffa9879eb79 - core::fmt::rt::Argument::fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/core\src\fmt\rt.rs:177
   5:     0x7ffa9879eb79 - core::fmt::write
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/core\src\fmt\mod.rs:1178
   6:     0x7ffa987640f7 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\io\mod.rs:1823
   7:     0x7ffa9876ddd5 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:42
   8:     0x7ffa98770ce7 - std::panicking::default_hook::closure$1
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:268
   9:     0x7ffa98770a9d - std::panicking::default_hook
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:295
  10:     0x7ffa99d9de20 - memchr
  11:     0x7ffa98771432 - alloc::boxed::impl$50::call
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/alloc\src\boxed.rs:2243
  12:     0x7ffa98771432 - std::panicking::rust_panic_with_hook
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:809
  13:     0x7ffa98771276 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:674
  14:     0x7ffa9876ea4f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:170
  15:     0x7ffa98770e86 - std::panicking::begin_panic_handler
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:665
  16:     0x7ffa9b6fd914 - core::panicking::panic_fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/core\src\panicking.rs:74
  17:     0x7ffac379664e - rustc_codegen_clr::binop::cmp::eq_unchecked
                               at C:\Users\gab\rustc_codegen_clr\src\binop\cmp.rs:79
  18:     0x7ffac3795d79 - rustc_codegen_clr::binop::cmp::ne_unchecked
                               at C:\Users\gab\rustc_codegen_clr\src\binop\cmp.rs:19
  19:     0x7ffac36f86b5 - rustc_codegen_clr::binop::binop
                               at C:\Users\gab\rustc_codegen_clr\src\binop\mod.rs:56
  20:     0x7ffac372bb26 - rustc_codegen_clr::rvalue::handle_rvalue
                               at C:\Users\gab\rustc_codegen_clr\src\rvalue.rs:71
  21:     0x7ffac37c2531 - rustc_codegen_clr::statement::handle_statement
                               at C:\Users\gab\rustc_codegen_clr\src\statement.rs:59
  22:     0x7ffac3712736 - rustc_codegen_clr::assembly::statement_to_ops::closure$0
                               at C:\Users\gab\rustc_codegen_clr\src\assembly.rs:301
  23:     0x7ffac3712736 - core::ops::function::FnOnce::call_once
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library\core\src\ops\function.rs:250
  24:     0x7ffac3712736 - core::panic::unwind_safe::impl$25::call_once
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library\core\src\panic\unwind_safe.rs:272
  25:     0x7ffac3712736 - std::panicking::try::do_call
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library\std\src\panicking.rs:557
  26:     0x7ffac3712736 - std::panicking::try
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library\std\src\panicking.rs:520
  27:     0x7ffac3712736 - std::panic::catch_unwind
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library\std\src\panic.rs:345
  28:     0x7ffac3712736 - rustc_codegen_clr::assembly::statement_to_ops
                               at C:\Users\gab\rustc_codegen_clr\src\assembly.rs:300
  29:     0x7ffac3713c01 - rustc_codegen_clr::assembly::add_fn
                               at C:\Users\gab\rustc_codegen_clr\src\assembly.rs:413
  30:     0x7ffac37170ba - rustc_codegen_clr::assembly::add_item
                               at C:\Users\gab\rustc_codegen_clr\src\assembly.rs:545
  31:     0x7ffac3751f45 - rustc_codegen_clr::impl$0::codegen_crate
                               at C:\Users\gab\rustc_codegen_clr\src\lib.rs:212
  32:     0x7ffa9580348c - <rustc_interface[cb3bfe6fe43ba9e1]::queries::Linker>::codegen_and_build_linker
  33:     0x7ffa957b326f - _rust_alloc_error_handler
  34:     0x7ffa957aec5f - _rust_alloc_error_handler
  35:     0x7ffa957b8b4b - _rust_alloc_error_handler
  36:     0x7ffa98782bbd - alloc::boxed::impl$48::call_once
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/alloc\src\boxed.rs:2229
  37:     0x7ffa98782bbd - alloc::boxed::impl$48::call_once
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/alloc\src\boxed.rs:2229
  38:     0x7ffa98782bbd - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\pal\windows\thread.rs:55
  39:     0x7ffb2b8a7374 - BaseThreadInitThunk
  40:     0x7ffb2bb1cc91 - RtlUserThreadStart

error: the compiler unexpectedly panicked. this is a bug.

note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

note: please attach the file at `C:\Users\gab\.cargo\registry\src\index.crates.io-6f17d22bba15001f\compiler_builtins-0.1.123\rustc-ice-2024-09-13T15_42_31-2296.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -Z force-unstable-if-unmarked -Z codegen-backend=C:\Users\gab\rustc_codegen_clr\target\release\librustc_codegen_clr.dll -C linker=\Users\gab\rustc_codegen_clr\target\release\linker.exe -C link-args=--cargo-support

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
Method "_ZN4core3f1621_$LT$impl$u20$f16$GT$6is_nan17hbbff1555b70b8e7eE" failed to compile statement _0 = Ne(copy _1, copy _1) with message Error("statement_to_ops panicked with a non-string message!")

thread 'rustc' panicked at src\call_info.rs:57:18:
not yet implemented: Unsuported ABI:Unadjusted
stack backtrace:
   0:     0x7ffa9876df91 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffa9876df91 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffa9876df91 - std::sys::backtrace::_print_fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:66
   3:     0x7ffa9876df91 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:39
   4:     0x7ffa9879eb79 - core::fmt::rt::Argument::fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/core\src\fmt\rt.rs:177
   5:     0x7ffa9879eb79 - core::fmt::write
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/core\src\fmt\mod.rs:1178
   6:     0x7ffa987640f7 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\io\mod.rs:1823
   7:     0x7ffa9876ddd5 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:42
   8:     0x7ffa98770ce7 - std::panicking::default_hook::closure$1
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:268
   9:     0x7ffa98770a9d - std::panicking::default_hook
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:295
  10:     0x7ffa99d9de20 - memchr
  11:     0x7ffa98771432 - alloc::boxed::impl$50::call
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/alloc\src\boxed.rs:2243
  12:     0x7ffa98771432 - std::panicking::rust_panic_with_hook
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:809
  13:     0x7ffa98771276 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:674
  14:     0x7ffa9876ea4f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:170
  15:     0x7ffa98770e86 - std::panicking::begin_panic_handler
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:665
  16:     0x7ffa9b6fd914 - core::panicking::panic_fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/core\src\panicking.rs:74
  17:     0x7ffac371fcf0 - rustc_codegen_clr::call_info::CallInfo::sig_from_instance_
                               at C:\Users\gab\rustc_codegen_clr\src\call_info.rs:57
  18:     0x7ffac3712cb2 - rustc_codegen_clr::assembly::add_fn
                               at C:\Users\gab\rustc_codegen_clr\src\assembly.rs:358
  19:     0x7ffac37170ba - rustc_codegen_clr::assembly::add_item
                               at C:\Users\gab\rustc_codegen_clr\src\assembly.rs:545
  20:     0x7ffac3751f45 - rustc_codegen_clr::impl$0::codegen_crate
                               at C:\Users\gab\rustc_codegen_clr\src\lib.rs:212
  21:     0x7ffa9580348c - <rustc_interface[cb3bfe6fe43ba9e1]::queries::Linker>::codegen_and_build_linker
  22:     0x7ffa957b326f - _rust_alloc_error_handler
  23:     0x7ffa957aec5f - _rust_alloc_error_handler
  24:     0x7ffa957b8b4b - _rust_alloc_error_handler
  25:     0x7ffa98782bbd - alloc::boxed::impl$48::call_once
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/alloc\src\boxed.rs:2229
  26:     0x7ffa98782bbd - alloc::boxed::impl$48::call_once
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/alloc\src\boxed.rs:2229
  27:     0x7ffa98782bbd - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\pal\windows\thread.rs:55
  28:     0x7ffb2b8a7374 - BaseThreadInitThunk
  29:     0x7ffb2bb1cc91 - RtlUserThreadStart

error: the compiler unexpectedly panicked. this is a bug.

note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

note: please attach the file at `C:\Users\gab\.cargo\registry\src\index.crates.io-6f17d22bba15001f\compiler_builtins-0.1.123\rustc-ice-2024-09-13T15_42_31-2296.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -Z force-unstable-if-unmarked -Z codegen-backend=C:\Users\gab\rustc_codegen_clr\target\release\librustc_codegen_clr.dll -C linker=\Users\gab\rustc_codegen_clr\target\release\linker.exe -C link-args=--cargo-support

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `compiler_builtins` (lib)

Caused by:
  process didn't exit successfully: `C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\bin\rustc.exe --crate-name compiler_builtins --edition=2021 C:\Users\gab\.cargo\registry\src\index.crates.io-6f17d22bba15001f\compiler_builtins-0.1.123\src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=189 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg "feature=\"compiler-builtins\"" --cfg "feature=\"core\"" --cfg "feature=\"default\"" --cfg "feature=\"rustc-dep-of-std\"" --check-cfg cfg(docsrs) --check-cfg "cfg(feature, values(\"c\", \"cc\", \"compiler-builtins\", \"core\", \"default\", \"mangled-names\", \"mem\", \"no-asm\", \"no-f16-f128\", \"public-test-deps\", \"rustc-dep-of-std\"))" -C metadata=1d2b8d1ac7f30968 -C extra-filename=-1d2b8d1ac7f30968 --out-dir C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\debug\deps --target x86_64-pc-windows-msvc -Z force-unstable-if-unmarked -L dependency=C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\debug\deps -L dependency=C:\Users\gab\Desktop\AngelaIfSheWasGood\target\debug\deps --extern core=C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\debug\deps\librustc_std_workspace_core-8c7f4905d6e3b222.rmeta --cap-lints allow -Z codegen-backend=C:\Users\gab\rustc_codegen_clr\target\release\librustc_codegen_clr.dll -C linker=\Users\gab\rustc_codegen_clr\target\release\linker.exe -C link-args=--cargo-support --cfg f16_enabled --cfg f128_enabled --cfg "feature=\"unstable\"" --cfg "feature=\"force-soft-floats\"" --cfg "feature=\"mem-unaligned\"" --check-cfg "cfg(__ashldi3, values(\"optimized-c\"))" --check-cfg "cfg(__ashlsi3, values(\"optimized-c\"))" --check-cfg "cfg(__ashrdi3, values(\"optimized-c\"))" --check-cfg "cfg(__ashrsi3, values(\"optimized-c\"))" --check-cfg "cfg(__bswapsi2, values(\"optimized-c\"))" --check-cfg "cfg(__bswapdi2, values(\"optimized-c\"))" --check-cfg "cfg(__bswapti2, values(\"optimized-c\"))" --check-cfg "cfg(__divdi3, values(\"optimized-c\"))" --check-cfg "cfg(__divsi3, values(\"optimized-c\"))" --check-cfg "cfg(__divmoddi4, values(\"optimized-c\"))" --check-cfg "cfg(__divmodsi4, values(\"optimized-c\"))" --check-cfg "cfg(__divmodsi4, values(\"optimized-c\"))" --check-cfg "cfg(__divmodti4, values(\"optimized-c\"))" --check-cfg "cfg(__lshrdi3, values(\"optimized-c\"))" --check-cfg "cfg(__lshrsi3, values(\"optimized-c\"))" --check-cfg "cfg(__moddi3, values(\"optimized-c\"))" --check-cfg "cfg(__modsi3, values(\"optimized-c\"))" --check-cfg "cfg(__muldi3, values(\"optimized-c\"))" --check-cfg "cfg(__udivdi3, values(\"optimized-c\"))" --check-cfg "cfg(__udivmoddi4, values(\"optimized-c\"))" --check-cfg "cfg(__udivmodsi4, values(\"optimized-c\"))" --check-cfg "cfg(__udivsi3, values(\"optimized-c\"))" --check-cfg "cfg(__umoddi3, values(\"optimized-c\"))" --check-cfg "cfg(__umodsi3, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas1_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas1_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas1_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas1_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas2_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas2_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas2_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas2_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas4_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas4_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas4_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas4_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas8_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas8_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas8_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas8_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas16_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas16_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas16_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_cas16_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd1_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd1_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd1_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd1_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd2_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd2_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd2_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd2_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd4_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd4_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd4_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd4_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd8_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd8_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd8_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldadd8_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr1_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr1_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr1_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr1_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr2_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr2_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr2_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr2_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr4_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr4_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr4_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr4_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr8_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr8_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr8_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldclr8_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor1_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor1_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor1_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor1_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor2_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor2_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor2_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor2_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor4_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor4_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor4_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor4_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor8_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor8_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor8_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldeor8_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset1_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset1_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset1_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset1_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset2_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset2_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset2_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset2_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset4_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset4_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset4_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset4_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset8_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset8_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset8_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_ldset8_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp1_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp1_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp1_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp1_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp2_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp2_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp2_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp2_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp4_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp4_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp4_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp4_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp8_relax, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp8_acq, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp8_rel, values(\"optimized-c\"))" --check-cfg "cfg(__aarch64_swp8_acq_rel, values(\"optimized-c\"))" --check-cfg "cfg(target_feature, values(\"vis3\"))" --check-cfg "cfg(feature, values(\"checked\"))" --check-cfg cfg(assert_no_panic) --check-cfg cfg(f16_enabled) --check-cfg cfg(f128_enabled) --check-cfg "cfg(feature, values(\"unstable\", \"force-soft-floats\"))" --check-cfg "cfg(feature, values(\"mem-unaligned\"))" --check-cfg cfg(thumb) --check-cfg cfg(thumb_1) --check-cfg cfg(kernel_user_helpers)` (exit code: 101)
warning: build failed, waiting for other jobs to finish...
Can't get the discirminant of type core::ops::ControlFlow<core::ops::try_trait::NeverShortCircuitResidual, ()>, because it is a zst. Size:0 Discr type:isize```

@FractalFir
Copy link
Owner

The to_string issue should be fixed - I had to update the signature of f128_support.

The f16 cmp issue is not fatal(the codegen can recover from it), but I have fixed it anyway.

I have also fixed Unadjusted ABI being unsupported, although I am not entirely certain if the fix is 100% correct.

Still, everything should build now.

@1Tiphereth
Copy link
Author

Alright gonna check it out now.

@1Tiphereth
Copy link
Author

It should also be said that the export script and the test suite looks for the file librustc_codegen_clr.dll whilst building the project (at least on windows) does not build the file with the specific name.

@1Tiphereth
Copy link
Author

Okay now it fails with a different error:

PS C:\Users\gab\Desktop\AngelaIfSheWasGood> cargo +nightly-2024-09-11-x86_64-pc-windows-msvc build
   Compiling compiler_builtins v0.1.123
   Compiling core v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core)
   Compiling windows-targets v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\windows_targets)
   Compiling std v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std)
   Compiling rustc-std-workspace-core v1.99.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-core)
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARINING: can't checked mul type i128
WARINING: can't checked mul type u128
WARINING: can't checked mul type i128
WARINING: can't checked mul type i128
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARINING: can't checked mul type u128
WARNING: argument debug info count invalid(Too few). Expected 4, got 3. fn name:_ZN4core3ops8function5FnMut8call_mut17h1f55573bb893e4b6E
   Compiling alloc v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc)
   Compiling cfg-if v1.0.0
   Compiling rustc-demangle v0.1.24
   Compiling unwind v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\unwind)
WARNING: argument debug info count invalid(Too few). Expected 4, got 3. fn name:_ZN4core3ops8function6FnOnce9call_once17he164b2d0777a1bbcE
WARNING: argument debug info count invalid(Too few). Expected 4, got 3. fn name:_ZN4core3ops8function6FnOnce9call_once17h9dc955fb6cda7d7aE
WARNING: argument debug info count invalid(Too few). Expected 4, got 3. fn name:_ZN4core3ops8function6FnOnce9call_once17h57c010c954f749cfE
WARNING: argument debug info count invalid(Too few). Expected 4, got 3. fn name:_ZN4core3ops8function6FnOnce9call_once17h9bae6d288fc10f44E
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
   Compiling rustc-std-workspace-alloc v1.99.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-alloc)
   Compiling panic_unwind v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\panic_unwind)
   Compiling panic_abort v0.0.0 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\panic_abort)
   Compiling std_detect v0.1.5 (C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\stdarch\crates\std_detect)
Inline assembly is not yet supported!
error: internal compiler error: compiler\rustc_hir_typeck\src\lib.rs:140:9: can't type-check body of DefId(0:67 ~ panic_unwind[a8f2]::imp::{extern#0}::TYPE_INFO_VTABLE)
   --> C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\panic_unwind\src\seh.rs:244:5
    |
244 |     static TYPE_INFO_VTABLE: *const u8;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at compiler\rustc_hir_typeck\src\lib.rs:140:9:
Box<dyn Any>
stack backtrace:
Can't get the discirminant of type core::ops::ControlFlow<core::ops::try_trait::NeverShortCircuitResidual, ()>, because it is a zst. Size:0 Discr type:isize
   Compiling hashbrown v0.14.5
   0:     0x7ffa9e7adf91 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffa9e7adf91 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffa9e7adf91 - std::sys::backtrace::_print_fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:66
   3:     0x7ffa9e7adf91 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:39
   4:     0x7ffa9e7deb79 - core::fmt::rt::Argument::fmt
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/core\src\fmt\rt.rs:177
   5:     0x7ffa9e7deb79 - core::fmt::write
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/core\src\fmt\mod.rs:1178
   6:     0x7ffa9e7a40f7 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\io\mod.rs:1823
   7:     0x7ffa9e7addd5 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\backtrace.rs:42
   8:     0x7ffa9e7b0ce7 - std::panicking::default_hook::closure$1
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:268
   9:     0x7ffa9e7b0a9d - std::panicking::default_hook
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:295
  10:     0x7ffa9fddde20 - memchr
  11:     0x7ffa9e7b1432 - alloc::boxed::impl$50::call
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/alloc\src\boxed.rs:2243
  12:     0x7ffa9e7b1432 - std::panicking::rust_panic_with_hook
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\panicking.rs:809
  13:     0x7ffaa1546873 - <rustc_hir_pretty[b0901d606756d998]::State>::print_variant
  14:     0x7ffaa1539019 - <rustc_hir_pretty[b0901d606756d998]::State>::print_variant
  15:     0x7ffaa1531e13 - <rustc_hir_pretty[b0901d606756d998]::State>::print_variant
  16:     0x7ffaa1552015 - <rustc_errors[2fd5922e9f54b36c]::diagnostic::BugAbort as rustc_errors[2fd5922e9f54b36c]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  17:     0x7ffaa009444c - rustc_sanitizers[37af79e81270a1b8]::cfi::typeid::itanium_cxx_abi::typeid_for_instance
  18:     0x7ffaa010fb07 - rustc_sanitizers[37af79e81270a1b8]::cfi::typeid::itanium_cxx_abi::typeid_for_instance
  19:     0x7ffaa011312d - rustc_sanitizers[37af79e81270a1b8]::cfi::typeid::itanium_cxx_abi::typeid_for_instance
  20:     0x7ffaa00c82f6 - rustc_sanitizers[37af79e81270a1b8]::cfi::typeid::itanium_cxx_abi::typeid_for_instance
  21:     0x7ffaa00c58f9 - rustc_sanitizers[37af79e81270a1b8]::cfi::typeid::itanium_cxx_abi::typeid_for_instance
  22:     0x7ffa9ea0e7ad - rustc_hir_typeck[f28cf5a5bd37e762]::typeck
  23:     0x7ffa9f399adb - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  24:     0x7ffa9f2d65e6 - rustc_ty_utils[4b2aaada5901d10d]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  25:     0x7ffa9f3a2273 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  26:     0x7ffa9ed8550e - rustc_mir_build[a33bd46d83b36403]::thir::pattern::check_match::check_match
  27:     0x7ffa9f39772b - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  28:     0x7ffa9f2d1ebf - rustc_ty_utils[4b2aaada5901d10d]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  29:     0x7ffa9f3a2d91 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  30:     0x7ffa9ed1ef62 - rustc_mir_build[a33bd46d83b36403]::build::mir_build
  31:     0x7ffa9ecb5a22 - rustc_mir_transform[f210fd02e3f31b45]::mir_built
  32:     0x7ffa9f399cbb - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  33:     0x7ffa9f2d65e6 - rustc_ty_utils[4b2aaada5901d10d]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  34:     0x7ffa9f39deb3 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  35:     0x7ffa9ecb5283 - rustc_mir_transform[f210fd02e3f31b45]::mir_const_qualif
  36:     0x7ffa9f398570 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  37:     0x7ffa9f27e26a - rustc_ty_utils[4b2aaada5901d10d]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  38:     0x7ffa9f39ddc2 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  39:     0x7ffa9ecb76e9 - rustc_mir_transform[f210fd02e3f31b45]::mir_promoted
  40:     0x7ffa9f397c79 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  41:     0x7ffa9f2ce464 - rustc_ty_utils[4b2aaada5901d10d]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  42:     0x7ffa9f39e4c6 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  43:     0x7ffa9ee941cf - rustc_borrowck[16e23b9e6aa9caae]::mir_borrowck
  44:     0x7ffa9f397bfb - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  45:     0x7ffa9f2d65e6 - rustc_ty_utils[4b2aaada5901d10d]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
Inline assembly is not yet supported!
  46:     0x7ffa9f3a2833 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  47:     0x7ffa9ecbf6ae - rustc_mir_transform[f210fd02e3f31b45]::mir_drops_elaborated_and_const_checked
  48:     0x7ffa9f3997ab - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  49:     0x7ffa9f2d65e6 - rustc_ty_utils[4b2aaada5901d10d]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  50:     0x7ffa9f39e2b3 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  51:     0x7ffa9ecbd1aa - rustc_mir_transform[f210fd02e3f31b45]::mir_for_ctfe
  52:     0x7ffa9f397c30 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  53:     0x7ffa9f27f315 - rustc_ty_utils[4b2aaada5901d10d]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  54:     0x7ffa9f39e3c5 - rustc_query_impl[ad68d91160f59db5]::plumbing::query_key_hash_verify_all
  55:     0x7ffa9f4323a5 - <rustc_const_eval[c731a4c81a351204]::const_eval::machine::CompileTimeMachine as rustc_const_eval[c731a4c81a351204]::interpret::machine::Machine>::find_mir_or_eval_fn
  56:     0x7ffa9e4325df - rustc_const_eval[c731a4c81a351204]::const_eval::eval_queries::eval_static_initializer_provider
  57:     0x7ffa9e380948 - rustc_ty_utils[4b2aaada5901d10d]::ty::adt_sized_constraint
  58:     0x7ffa9e363e2d - rustc_ty_utils[4b2aaada5901d10d]::ty::adt_sized_constraint
  59:     0x7ffa9f253c1a - rustc_ty_utils[4b2aaada5901d10d]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  60:     0x7ffa9e393cd8 - rustc_query_impl[ad68d91160f59db5]::query_system
  61:     0x7ffb0e83da5a - rustc_middle::query::plumbing::query_get_at<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<array$<u8,16> > > >
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\compiler\rustc_middle\src\query\plumbing.rs:143
  62:     0x7ffb0e847fed - rustc_codegen_clr::assembly::add_allocation
                               at C:\Users\gab\rustc_codegen_clr\src\assembly.rs:627
  63:     0x7ffb0e849368 - rustc_codegen_clr::assembly::add_allocation
                               at C:\Users\gab\rustc_codegen_clr\src\assembly.rs:684
  64:     0x7ffb0e8471a9 - rustc_codegen_clr::assembly::add_item
                               at C:\Users\gab\rustc_codegen_clr\src\assembly.rs:611
  65:     0x7ffb0e8dda65 - rustc_codegen_clr::impl$0::codegen_crate
                               at C:\Users\gab\rustc_codegen_clr\src\lib.rs:212
  66:     0x7ffa9b84348c - <rustc_interface[cb3bfe6fe43ba9e1]::queries::Linker>::codegen_and_build_linker
  67:     0x7ffa9b7f326f - _rust_alloc_error_handler
  68:     0x7ffa9b7eec5f - _rust_alloc_error_handler
  69:     0x7ffa9b7f8b4b - _rust_alloc_error_handler
  70:     0x7ffa9e7c2bbd - alloc::boxed::impl$48::call_once
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/alloc\src\boxed.rs:2229
  71:     0x7ffa9e7c2bbd - alloc::boxed::impl$48::call_once
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/alloc\src\boxed.rs:2229
  72:     0x7ffa9e7c2bbd - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/0ee7cb5e3633502d9a90a85c3c367eccd59a0aba\library/std\src\sys\pal\windows\thread.rs:55
  73:     0x7ffb2b8a7374 - BaseThreadInitThunk
  74:     0x7ffb2bb1cc91 - RtlUserThreadStart

note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

note: please attach the file at `C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\panic_unwind\rustc-ice-2024-09-13T19_42_15-13480.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -Z force-unstable-if-unmarked -Z codegen-backend=C:\Users\gab\rustc_codegen_clr\target\release\rustc_codegen_clr.dll -C linker=\Users\gab\rustc_codegen_clr\target\release\linker.exe -C link-args=--cargo-support

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [typeck] type-checking `imp::TYPE_INFO_VTABLE`
#1 [check_match] match-checking `imp::TYPE_INFO_VTABLE`
end of query stack
error: could not compile `panic_unwind` (lib)

Caused by:
  process didn't exit successfully: `C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\bin\rustc.exe --crate-name panic_unwind --edition=2021 C:\Users\gab\.rustup\toolchains\nightly-2024-09-11-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\panic_unwind\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=189 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --warn=unexpected_cfgs --check-cfg cfg(docsrs) --check-cfg "cfg(feature, values())" --check-cfg "cfg(target_os, values(\"rtems\"))" -C metadata=7d33b6a3b2661cd4 -C extra-filename=-7d33b6a3b2661cd4 --out-dir C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\debug\deps --target x86_64-pc-windows-msvc -Z force-unstable-if-unmarked -L dependency=C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\debug\deps -L dependency=C:\Users\gab\Desktop\AngelaIfSheWasGood\target\debug\deps --extern alloc=C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\debug\deps\liballoc-b49fafcbaa424f93.rmeta --extern cfg_if=C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\debug\deps\libcfg_if-13bdfa8ba972612f.rmeta --extern compiler_builtins=C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\debug\deps\libcompiler_builtins-1d2b8d1ac7f30968.rmeta --extern core=C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\debug\deps\libcore-cfcf8c0f514624cf.rmeta --extern unwind=C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\debug\deps\libunwind-f0f97dd9d2dcd5ec.rmeta --cap-lints allow -Z codegen-backend=C:\Users\gab\rustc_codegen_clr\target\release\rustc_codegen_clr.dll -C linker=\Users\gab\rustc_codegen_clr\target\release\linker.exe -C link-args=--cargo-support` (exit code: 101)
warning: build failed, waiting for other jobs to finish...```

@FractalFir
Copy link
Owner

This looks like a Rust bug, that should be fixed after an update to the newest nightly

I will look into this issue later, I am currently having trouble updating my Rust install.

@1Tiphereth
Copy link
Author

here is the issue for the nightly error rust-lang/rust#130309

@1Tiphereth
Copy link
Author

Still can't compile panic_unwind even under latest nightly

@FractalFir
Copy link
Owner

Out of curiosity: can you run the project test suite?

cargo test ::stable

@1Tiphereth
Copy link
Author

All tests fail with the error

---- compile_test::round::stable::release stdout ----
thread 'compile_test::round::stable::release' panicked at src\compile_test.rs:621:76:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }```

@1Tiphereth
Copy link
Author

image

@FractalFir
Copy link
Owner

That issue should be fixed now.

@1Tiphereth
Copy link
Author

All tests failed:
log1.txt

@FractalFir
Copy link
Owner

Ok, so it seems like the arguments passed to the linker are very different from those on Linux. This was not a problem before I refactored the link process, but it is a problem now.

In the newest version, the linker should fail with a more verbose error message. I can use this message to update the command line parsing.

Could you please run:

cargo test add::stable::debug

That should run only the simplest test, which should make fixes easier.

@1Tiphereth
Copy link
Author

Hi sorry for the wait, here is the log (I think I have the latest version?)

running 1 test
test compile_test::add::stable::debug ... FAILED

failures:

---- compile_test::add::stable::debug stdout ----
test_name:"debug_add"
thread 'compile_test::add::stable::debug' panicked at src\compile_test.rs:679:1:
stdout:
fn item Instance { def: Item(DefId(0:33 ~ add[5837]::rustc_clr_interop_managed_call1_)), args: ["System.Console", "System.Console", false, "WriteLine", true, (), u32] } is magic and is being skiped.

stderr:
error: linking with `\\?\C:\Users\gab\rustc_codegen_clr\target\debug\linker.exe` failed: exit code: 101
  |
  = note: "\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "/NOLOGO" "C:\\Users\\gab\\AppData\\Local\\Temp\\rustcdZHpen\\symbols.o" ".\\debug_add.bc" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-5a536bba43fbe272.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-45b7a05b67ddb8c6.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-da01fb5db34082e2.rlib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:./debug_add.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note: thread 'main' panicked at cilly\src\bin\linker\main.rs:154:10:
          No output file! ["/NOLOGO", "C:\\Users\\gab\\AppData\\Local\\Temp\\rustcdZHpen\\symbols.o", ".\\debug_add.bc", "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-5a536bba43fbe272.rlib", "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-45b7a05b67ddb8c6.rlib", "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-da01fb5db34082e2.rlib", "/defaultlib:msvcrt", "/NXCOMPAT", "/OUT:./debug_add.exe", "/OPT:REF,NOICF", "/DEBUG", "/PDBALTPATH:%_PDB%", "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis", "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis", "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis", "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"]
          note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


error: aborting due to 1 previous error


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    compile_test::add::stable::debug

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 217 filtered out; finished in 14.41s

error: test failed, to rerun pass `--lib````

@FractalFir
Copy link
Owner

Hi sorry for the wait

No need to apologize :).

Hopefully, argument parsing should be fixed now.

@1Tiphereth
Copy link
Author

trying to rebuild fails with new error:

error[E0308]: mismatched types
   --> cilly\src\bin\linker\main.rs:164:41
    |
164 |     let output_file_path = get_out_path(args);
    |                            ------------ ^^^^ expected `&[&str]`, found `&[String]`
    |                            |
    |                            arguments to this function are incorrect
    |
    = note: expected reference `&[&str]`
               found reference `&[String]`
note: function defined here
   --> cilly\src\bin\linker\main.rs:141:4
    |
141 | fn get_out_path<'a>(args: &'a [&str]) -> &'a str {
    |    ^^^^^^^^^^^^     ----------------

@FractalFir
Copy link
Owner

Should be fixed now.

@1Tiphereth
Copy link
Author

Build compiles but using it in a project fails with:
build.log

Tests fail with:
test2.log

@1Tiphereth
Copy link
Author

1Tiphereth commented Sep 14, 2024

config.toml (default from quick.md)

[build] 
target = "x86_64-pc-windows-msvc" # Change to the host target.
[unstable]
build-std = ["core","alloc","std","panic_abort"]```

@FractalFir
Copy link
Owner

I (hopefully) fixed the issue. I used strip_suffix instead of strip_prefix when parsing arguments.

@1Tiphereth
Copy link
Author

error[E0599]: no method named `strip_preffix` found for reference `&String` in the current scope
   --> cilly\src\bin\linker\main.rs:143:31
    |
143 |         .filter_map(|arg| arg.strip_preffix("/OUT:"))
    |                               ^^^^^^^^^^^^^
    |
help: there is a method `strip_prefix` with a similar name
    |
143 |         .filter_map(|arg| arg.strip_prefix("/OUT:"))
    |                               ~~~~~~~~~~~~```
oops

@1Tiphereth
Copy link
Author

Either way, fixing the typo, still causes tests to fail

@1Tiphereth
Copy link
Author

---- compile_test::xor::stable::release stdout ----
Command: "rustc" "-O" "-Z" "codegen-backend=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\rustc_codegen_clr.dll" "-C" "linker=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "--edition" "2021" "./xor.rs" "-o" "./xor.exe"
thread 'compile_test::xor::stable::release' panicked at src\compile_test.rs:688:1:
stdout:
fn item Instance { def: Item(DefId(0:29 ~ xor[e662]::rustc_clr_interop_managed_call1_)), args: ["System.Console", "System.Console", false, "WriteLine", true, (), u32] } is magic and is being skiped.

stderr:
error: linking with `\\?\C:\Users\gab\rustc_codegen_clr\target\debug\linker.exe` failed: exit code: 101
  |
  = note: "\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "/NOLOGO" "C:\\Users\\gab\\AppData\\Local\\Temp\\rustcDNHGTG\\symbols.o" ".\\xor.bc" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-5a536bba43fbe272.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-45b7a05b67ddb8c6.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-da01fb5db34082e2.rlib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:./xor.exe" "/OPT:REF,ICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note: thread 'main' panicked at cilly\src\v2\asm.rs:946:18:
          called `Result::unwrap()` on an `Err` value: Error { kind: NotFound, message: "program not found" }
          note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
          Preparing to load assmeblies
          Loaded assmeblies
          Eliminating dead code

@FractalFir
Copy link
Owner

Well, this error means that the codegen can't find the IL assembler, ilasm. Is ilasm installed on your machine?

@1Tiphereth
Copy link
Author

While ilasm cannot be run on regular cmd/powershell and only on developer powershell, it still fails even on a dev. powershell window
image
Tests fail too, this time with a different error.

---- compile_test::wrapping_ops::stable::debug stdout ----
test_name:"debug_wrapping_ops"
thread 'compile_test::wrapping_ops::stable::debug' panicked at src\compile_test.rs:52:9:
Test program failed with message ERROR: Invalid syntax. Default option is not allowed more than '1' time(s).
Type "TIMEOUT /?" for usage.


---- compile_test::xor::stable::debug stdout ----
test_name:"debug_xor"
thread 'compile_test::xor::stable::debug' panicked at src\compile_test.rs:52:9:
Test program failed with message ERROR: Invalid syntax. Default option is not allowed more than '1' time(s).
Type "TIMEOUT /?" for usage.


---- compile_test::vec::stable::release stdout ----
Command: "rustc" "-O" "-Z" "codegen-backend=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\rustc_codegen_clr.dll" "-C" "linker=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "--edition" "2021" "./vec.rs" "-o" "./vec.exe"
thread 'compile_test::vec::stable::release' panicked at src\compile_test.rs:52:9:
Test program failed with message ERROR: Invalid syntax. Default option is not allowed more than '1' time(s).
Type "TIMEOUT /?" for usage.


---- compile_test::wrapping_ops::stable::release stdout ----
Command: "rustc" "-O" "-Z" "codegen-backend=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\rustc_codegen_clr.dll" "-C" "linker=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "--edition" "2021" "./wrapping_ops.rs" "-o" "./wrapping_ops.exe"
thread 'compile_test::wrapping_ops::stable::release' panicked at src\compile_test.rs:52:9:
Test program failed with message ERROR: Invalid syntax. Default option is not allowed more than '1' time(s).
Type "TIMEOUT /?" for usage.


---- compile_test::xor::stable::release stdout ----
Command: "rustc" "-O" "-Z" "codegen-backend=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\rustc_codegen_clr.dll" "-C" "linker=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "--edition" "2021" "./xor.rs" "-o" "./xor.exe"
thread 'compile_test::xor::stable::release' panicked at src\compile_test.rs:52:9:
Test program failed with message ERROR: Invalid syntax. Default option is not allowed more than '1' time(s).
Type "TIMEOUT /?" for usage.

@FractalFir
Copy link
Owner

FractalFir commented Sep 14, 2024

I will look into this issue .

@1Tiphereth
Copy link
Author

1Tiphereth commented Sep 14, 2024

PS C:\Users\gab\rustc_codegen_clr> dotnet --info
.NET SDK:
 Version:           8.0.202
 Commit:            25674bb2f4
 Workload version:  8.0.200-manifests.8cf8de6d

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.202\

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      8.0.3
  Architecture: x64
  Commit:       9f4b1f5d66

.NET SDKs installed:
  8.0.202 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.28 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

I couldn't find how to get ilasm version

@FractalFir
Copy link
Owner

FractalFir commented Sep 14, 2024

Never mind, the issue was with the timeout command. The tests on windows now should run without any timeouts, which should fix the issue.

@1Tiphereth
Copy link
Author

Tests fail yet again, Regular builds still fail with errors that it could not compile std, panic_unwind

---- compile_test::tuple_enum::stable::release stdout ----
Command: "rustc" "-O" "-Z" "codegen-backend=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\rustc_codegen_clr.dll" "-C" "linker=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "--edition" "2021" "./tuple_enum.rs" "-o" "./tuple_enum.exe"
thread 'compile_test::tuple_enum::stable::release' panicked at src\compile_test.rs:62:9:
Test program failed with message Could not execute because the specified command or file was not found.


---- compile_test::types::stable::debug stdout ----
thread 'compile_test::types::stable::debug' panicked at src\compile_test.rs:132:9:
stdout:

stderr:
thread 'main' panicked at cilly\src\bin\linker\main.rs:145:10:
No output file! ["-o", "./types.dll", "./types.rlib"]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


---- compile_test::type_id::stable::debug stdout ----
test_name:"debug_type_id"
thread 'compile_test::type_id::stable::debug' panicked at src\compile_test.rs:62:9:
Test program failed with message Could not execute because the specified command or file was not found.


---- compile_test::types::stable::release stdout ----
thread 'compile_test::types::stable::release' panicked at src\compile_test.rs:132:9:
stdout:

stderr:
thread 'main' panicked at cilly\src\bin\linker\main.rs:145:10:
No output file! ["-o", "./types.dll", "./types.rlib"]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


---- compile_test::tuple_structs::stable::release stdout ----
Command: "rustc" "-O" "-Z" "codegen-backend=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\rustc_codegen_clr.dll" "-C" "linker=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "--edition" "2021" "./tuple_structs.rs" "-o" "./tuple_structs.exe"
thread 'compile_test::tuple_structs::stable::release' panicked at src\compile_test.rs:62:9:
Test program failed with message Could not execute because the specified command or file was not found.


---- compile_test::type_id::stable::release stdout ----
Command: "rustc" "-O" "-Z" "codegen-backend=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\rustc_codegen_clr.dll" "-C" "linker=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "--edition" "2021" "./type_id.rs" "-o" "./type_id.exe"
thread 'compile_test::type_id::stable::release' panicked at src\compile_test.rs:62:9:
Test program failed with message Could not execute because the specified command or file was not found.


---- compile_test::vec::stable::debug stdout ----
test_name:"debug_vec"
thread 'compile_test::vec::stable::debug' panicked at src\compile_test.rs:62:9:
Test program failed with message Could not execute because the specified command or file was not found.


---- compile_test::wrapping_ops::stable::debug stdout ----
test_name:"debug_wrapping_ops"
thread 'compile_test::wrapping_ops::stable::debug' panicked at src\compile_test.rs:62:9:
Test program failed with message Could not execute because the specified command or file was not found.


---- compile_test::vec::stable::release stdout ----
Command: "rustc" "-O" "-Z" "codegen-backend=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\rustc_codegen_clr.dll" "-C" "linker=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "--edition" "2021" "./vec.rs" "-o" "./vec.exe"
thread 'compile_test::vec::stable::release' panicked at src\compile_test.rs:62:9:
Test program failed with message Could not execute because the specified command or file was not found.


---- compile_test::wrapping_ops::stable::release stdout ----
Command: "rustc" "-O" "-Z" "codegen-backend=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\rustc_codegen_clr.dll" "-C" "linker=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "--edition" "2021" "./wrapping_ops.rs" "-o" "./wrapping_ops.exe"
thread 'compile_test::wrapping_ops::stable::release' panicked at src\compile_test.rs:62:9:
Test program failed with message Could not execute because the specified command or file was not found.


---- compile_test::xor::stable::debug stdout ----
test_name:"debug_xor"
thread 'compile_test::xor::stable::debug' panicked at src\compile_test.rs:62:9:
Test program failed with message Could not execute because the specified command or file was not found.


---- compile_test::xor::stable::release stdout ----
Command: "rustc" "-O" "-Z" "codegen-backend=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\rustc_codegen_clr.dll" "-C" "linker=\\\\?\\C:\\Users\\gab\\rustc_codegen_clr\\target\\debug\\linker.exe" "--edition" "2021" "./xor.rs" "-o" "./xor.exe"
thread 'compile_test::xor::stable::release' panicked at src\compile_test.rs:62:9:
Test program failed with message Could not execute because the specified command or file was not found.

@1Tiphereth
Copy link
Author

I suggest maybe trying out changes in a VM to speed the process if not already.

@1Tiphereth
Copy link
Author

Any progress?

@FractalFir
Copy link
Owner

Any progress?

Well, I am having some trouble setting up a Windows 11 VM. I need to setup stuff like a TPM, so I need some time to figure out how to do that.

@1Tiphereth
Copy link
Author

I recommend just using a Windows 10 VM instead

@1Tiphereth
Copy link
Author

Ok so I was able to get it to compile without errors but the file output is a rlib??
(removing std & unwind from cargo.toml)

@1Tiphereth
Copy link
Author

Upon removing "std","panic_abort" it compiles but as an rlib, adding cdylib/etc crashes with the error of:
(trying to get it into a .dll?)

PS C:\Users\gab\Desktop\AngelaIfSheWasGood> cargo +nightly build --release
WARINING: can't checked mul type i128
WARINING: can't checked mul type i128
WARINING: can't checked mul type u128
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Can't get the discirminant of type core::ops::ControlFlow<core::ops::try_trait::NeverShortCircuitResidual, ()>, because it is a zst. Size:0 Discr type:isize
Can't get the discirminant of type core::ops::ControlFlow<core::ops::try_trait::NeverShortCircuitResidual, ()>, because it is a zst. Size:0 Discr type:isize
   Compiling AngelaIfSheWasGood v0.1.0 (C:\Users\gab\Desktop\AngelaIfSheWasGood)
warning: crate `AngelaIfSheWasGood` should have a snake case name
  |
  = help: convert the identifier to snake case: `angela_if_she_was_good`
  = note: `#[warn(non_snake_case)]` on by default

error: linking with `\Users\gab\rustc_codegen_clr\target\release\linker.exe` failed: exit code: 101
  |
  = note: "\\Users\\gab\\rustc_codegen_clr\\target\\release\\linker.exe" "/DEF:C:\\Users\\gab\\AppData\\Local\\Temp\\rustctRBLR3\\lib.def" "/NOLOGO" "C:\\Users\\gab\\AppData\\Local\\Temp\\rustctRBLR3\\symbols.o" "C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\release\\deps\\AngelaIfSheWasGood.bc" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-01597f27f694b085.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-ca883b30b865bcbe.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libwindows_targets-650a9189f256d76e.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-734ad80e1c81dc13.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-46004453010eab20.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-0b7c9e6eacd4c6ea.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-16fc4403b4b65962.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-2fe51007c6e0e48e.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-b77942bb4d7a61c7.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-1f2e1676cb7a26c6.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-5a536bba43fbe272.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-45b7a05b67ddb8c6.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-da01fb5db34082e2.rlib" "kernel32.lib" "kernel32.lib" "advapi32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\release\\deps\\AngelaIfSheWasGood.dll" "/OPT:REF,ICF" "/DLL" "/IMPLIB:C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\release\\deps\\AngelaIfSheWasGood.dll.lib" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis" "--cargo-support"
  = note: thread 'main' panicked at cilly\src\bin\linker\main.rs:468:13:
          error: couldn't read `C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\release\deps\AngelaIfSheWasGood.exe`: The system cannot find the file specified. (os error 2)
           --> C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\release\deps\AngelaIfSheWasGood.rs:2:32
            |
          2 | static DOTNET_ASSEMBLY:&[u8] = include_bytes!("AngelaIfSheWasGood.exe");
            |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            |
            = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

          error: aborting due to 1 previous error


          note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
          Preparing to load assmeblies
          Loaded assmeblies
          Eliminating dead code


warning: `AngelaIfSheWasGood` (lib) generated 1 warning
error: could not compile `AngelaIfSheWasGood` (lib) due to 1 previous error; 1 warning emitted

@1Tiphereth
Copy link
Author

Upon removing "std","panic_abort" it compiles but as an rlib, adding cdylib/etc crashes with the error of: (trying to get it into a .dll?)

PS C:\Users\gab\Desktop\AngelaIfSheWasGood> cargo +nightly build --release
WARINING: can't checked mul type i128
WARINING: can't checked mul type i128
WARINING: can't checked mul type u128
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Inline assembly is not yet supported!
Can't get the discirminant of type core::ops::ControlFlow<core::ops::try_trait::NeverShortCircuitResidual, ()>, because it is a zst. Size:0 Discr type:isize
Can't get the discirminant of type core::ops::ControlFlow<core::ops::try_trait::NeverShortCircuitResidual, ()>, because it is a zst. Size:0 Discr type:isize
   Compiling AngelaIfSheWasGood v0.1.0 (C:\Users\gab\Desktop\AngelaIfSheWasGood)
warning: crate `AngelaIfSheWasGood` should have a snake case name
  |
  = help: convert the identifier to snake case: `angela_if_she_was_good`
  = note: `#[warn(non_snake_case)]` on by default

error: linking with `\Users\gab\rustc_codegen_clr\target\release\linker.exe` failed: exit code: 101
  |
  = note: "\\Users\\gab\\rustc_codegen_clr\\target\\release\\linker.exe" "/DEF:C:\\Users\\gab\\AppData\\Local\\Temp\\rustctRBLR3\\lib.def" "/NOLOGO" "C:\\Users\\gab\\AppData\\Local\\Temp\\rustctRBLR3\\symbols.o" "C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\release\\deps\\AngelaIfSheWasGood.bc" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-01597f27f694b085.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-ca883b30b865bcbe.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libwindows_targets-650a9189f256d76e.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-734ad80e1c81dc13.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-46004453010eab20.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-0b7c9e6eacd4c6ea.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-16fc4403b4b65962.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-2fe51007c6e0e48e.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-b77942bb4d7a61c7.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-1f2e1676cb7a26c6.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-5a536bba43fbe272.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-45b7a05b67ddb8c6.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-da01fb5db34082e2.rlib" "kernel32.lib" "kernel32.lib" "advapi32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\release\\deps\\AngelaIfSheWasGood.dll" "/OPT:REF,ICF" "/DLL" "/IMPLIB:C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\release\\deps\\AngelaIfSheWasGood.dll.lib" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis" "--cargo-support"
  = note: thread 'main' panicked at cilly\src\bin\linker\main.rs:468:13:
          error: couldn't read `C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\release\deps\AngelaIfSheWasGood.exe`: The system cannot find the file specified. (os error 2)
           --> C:\Users\gab\Desktop\AngelaIfSheWasGood\target\x86_64-pc-windows-msvc\release\deps\AngelaIfSheWasGood.rs:2:32
            |
          2 | static DOTNET_ASSEMBLY:&[u8] = include_bytes!("AngelaIfSheWasGood.exe");
            |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            |
            = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

          error: aborting due to 1 previous error


          note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
          Preparing to load assmeblies
          Loaded assmeblies
          Eliminating dead code


warning: `AngelaIfSheWasGood` (lib) generated 1 warning
error: could not compile `AngelaIfSheWasGood` (lib) due to 1 previous error; 1 warning emitted

image

@FractalFir
Copy link
Owner

The issue is within the linker, and an rlib does not use the linker.
I can see that you have a .il file. You can try assembling it manually using ilasm, and see if that works.

@1Tiphereth
Copy link
Author

Could you provide a command to do that?

@1Tiphereth
Copy link
Author

1Tiphereth commented Sep 15, 2024

ilasm .\target\x86_64-pc-windows-msvc\release\deps\AngelaIfSheWasGood.il /output=./a.dll /dll ?
image

@FractalFir
Copy link
Owner

I have fixed most of the issues present on Windows.

ILASM will now get detected, even in a non-developer shell.

For some reason, the Windows version of ilasm creates only a pdb file(and no .exe) when -debug is specified.
I have added a workaround for this issue: I call ilasm twice, once to create the assembly, and once to create the debug-info.

I have also fixed the tests. They did not work due to the differences in Linux and Windows path delimiters(/ vs \), and different behavior when using relative paths with std::process::Command.

I have also fixed Windows libc path(the assemblies generated by the project currently reference libc functions used by std).

Most tests are currently broken, since it seems like the wrong version of the runtime libraries gets loaded(4.0.0), which causes TypeLoadExceptions, since things like System.UInt128 were not yet present in that version.

Besides that, I will also need to see if this fixes issues with building crates / cargo integration.

@1Tiphereth
Copy link
Author

Well std, rust_unwind still fails to compile,
building an exe - include_bytes! file not found error
building an library (with user perms) -

warning: crate `AngelaIfSheWasGood` should have a snake case name
  |
  = help: convert the identifier to snake case: `angela_if_she_was_good`
  = note: `#[warn(non_snake_case)]` on by default

error: linking with `\Users\gab\rustc_codegen_clr\target\release\linker.exe` failed: exit code: 101
  |
  = note: "\\Users\\gab\\rustc_codegen_clr\\target\\release\\linker.exe" "/DEF:C:\\Users\\gab\\AppData\\Local\\Temp\\rustcHBhAEz\\lib.def" "/NOLOGO" "C:\\Users\\gab\\AppData\\Local\\Temp\\rustcHBhAEz\\symbols.o" "C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\debug\\deps\\AngelaIfSheWasGood.bc" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-01597f27f694b085.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-ca883b30b865bcbe.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libwindows_targets-650a9189f256d76e.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-734ad80e1c81dc13.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-46004453010eab20.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-0b7c9e6eacd4c6ea.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-16fc4403b4b65962.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-2fe51007c6e0e48e.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-b77942bb4d7a61c7.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-1f2e1676cb7a26c6.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-5a536bba43fbe272.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-45b7a05b67ddb8c6.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-da01fb5db34082e2.rlib" "kernel32.lib" "kernel32.lib" "advapi32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\debug\\deps\\AngelaIfSheWasGood.dll" "/OPT:REF,NOICF" "/DLL" "/IMPLIB:C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\debug\\deps\\AngelaIfSheWasGood.dll.lib" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis" "--cargo-support"
  = note: thread 'main' panicked at cilly\src\bin\linker\main.rs:469:13:
          error: couldn't create a temp dir: Access is denied. (os error 5) at path "C:\\Windows\\rustcUXvfLu"

          error: aborting due to 1 previous error


          note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
          Preparing to load assmeblies
          Loaded assmeblies
          Eliminating dead code


warning: `AngelaIfSheWasGood` (lib) generated 1 warning
error: could not compile `AngelaIfSheWasGood` (lib) due to 1 previous error; 1 warning emitted

building an library (with admin perms) -

warning: crate `AngelaIfSheWasGood` should have a snake case name
  |
  = help: convert the identifier to snake case: `angela_if_she_was_good`
  = note: `#[warn(non_snake_case)]` on by default

error: linking with `\Users\gab\rustc_codegen_clr\target\release\linker.exe` failed: exit code: 101
  |
  = note: "\\Users\\gab\\rustc_codegen_clr\\target\\release\\linker.exe" "/DEF:C:\\Users\\gab\\AppData\\Local\\Temp\\rustcOed6NQ\\lib.def" "/NOLOGO" "C:\\Users\\gab\\AppData\\Local\\Temp\\rustcOed6NQ\\symbols.o" "C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\debug\\deps\\AngelaIfSheWasGood.bc" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-01597f27f694b085.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-ca883b30b865bcbe.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libwindows_targets-650a9189f256d76e.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-734ad80e1c81dc13.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-46004453010eab20.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-0b7c9e6eacd4c6ea.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-16fc4403b4b65962.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-2fe51007c6e0e48e.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-b77942bb4d7a61c7.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-1f2e1676cb7a26c6.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-5a536bba43fbe272.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-45b7a05b67ddb8c6.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-da01fb5db34082e2.rlib" "kernel32.lib" "kernel32.lib" "advapi32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\debug\\deps\\AngelaIfSheWasGood.dll" "/OPT:REF,NOICF" "/DLL" "/IMPLIB:C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\debug\\deps\\AngelaIfSheWasGood.dll.lib" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis" "--cargo-support"
  = note: thread 'main' panicked at cilly\src\bin\linker\main.rs:469:13:
          error: linking with `link.exe` failed: exit code: 1181
            |
            = note: "link.exe" "/NOLOGO" "C:\\Windows\\rustc6D4Ylb\\symbols.o" "C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\debug\\deps\\AngelaIfSheWasGood.AngelaIfSheWasGood.aed087d530562371-cgu.0.rcgu.o" "C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\debug\\deps\\AngelaIfSheWasGood.AngelaIfSheWasGood.aed087d530562371-cgu.1.rcgu.o" "C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\debug\\deps\\AngelaIfSheWasGood.3yq3uo3oqpmhv2l5qqszu74fo.rcgu.o" "/LIBPATH:C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-759718a9bb18a123.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-7da375a7ca1e9a5e.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-13c5a35fb3626718.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-67d9d7b318bd750d.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-1128f34f910afc3a.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-ec2cabfc22cdef7d.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-93dda7487230aeda.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-814df84e64e9c749.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-bcbe36736b9f0af2.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-d08e4e7d05aff086.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-89ef43c30f9b928e.rlib" "C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-1426abde5263ac46.rlib" "kernel32.lib" "advapi32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "kernel32.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/LIBPATH:C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:C:\\Users\\gab\\Desktop\\AngelaIfSheWasGood\\target\\x86_64-pc-windows-msvc\\debug\\deps\\AngelaIfSheWasGood.dll" "/OPT:REF,ICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\gab\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
            = note: LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'␍


          error: aborting due to 1 previous error


          note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
          Preparing to load assmeblies
          Loaded assmeblies
          Eliminating dead code


warning: `AngelaIfSheWasGood` (lib) generated 1 warning
error: could not compile `AngelaIfSheWasGood` (lib) due to 1 previous error; 1 warning emitted

@FractalFir
Copy link
Owner

FractalFir commented Sep 16, 2024

What happens when you remove --cargo-support from the linker args?

Currently, it seems like the linker fails when building the bootstrap wrapper(this is what starts the .NET runtime on Linux or MacOS). Since Windows does not require such wrapper scripts, maybe removing --cargo-support fixes the issue?

PS: building libraries is not fully supported ATM. There is some code to do that, but it is not very well tested.

@1Tiphereth
Copy link
Author

That does indeed make executables compile, although without stdsupport the program is rather limited, it should be said that removing the flag does also make the library compile but it still does not produce a .dll output

@FractalFir
Copy link
Owner

That does indeed make executables compile, although without stdsupport the program is rather limited, it should be said that removing the flag does also make the library compile but it still does not produce a .dll output

Well, std is partially supported, even on Windows. When using something that is not supported, you should simply get an exception with the message missing methiod EXTERN_FN_NAME . If you build a simple program, do you get an excpetion like this?

PS: --cargo-support is only responsible for compatibility with OSs which don't support directly launching .NET excutables, and require the runtime to be explicitly started.

@1Tiphereth
Copy link
Author

fn main() {
    let mut a: u32 = 7;
    a += 5;
    println!("Hello, world!");
}

Having std & panic_unwind in the config.toml causes the build to fail upon trying to compile them, removing them does make it compile but any attemps to use std features such as in the code mentioned above result in:

Unhandled Exception: System.Exception: missing methiod _ZN3std2io5stdio6_print17hecaf0c77a8a5faf7E
   at MainModule._ZN3std2io5stdio6_print17hecaf0c77a8a5faf7E(hc4bee4141302ac97 A_0)
   at MainModule._ZN14Tiph1Framework4main17h06acd88da94b0a99E()
   at MainModule.entrypoint()
error: process didn't exit successfully: `target\x86_64-pc-windows-msvc\debug\Tiph1Framework.exe` (exit code: 0xe0434352)

@FractalFir
Copy link
Owner

What about std and panic_abort?

@1Tiphereth
Copy link
Author

Oops I meant panic_abort yes I just have it memorized like so because of the unwind errors

@1Tiphereth
Copy link
Author

Is wrapped_mono compatible with this project?

@FractalFir
Copy link
Owner

Is wrapped_mono compatible with this project?

Kind of?
wrapped_mono is just a wrapper around the Mono runtime, so as long as something is compatible with Mono, it is also compatible with wrapped_mono(although wrapped_mono is still a bit buggy).

The problem with mono is that it does not support new .NET features, such as 128 bit ints or aligned native allocators, which are needed for Rust to function.

@1Tiphereth
Copy link
Author

Are you able to create an equivalent of the following C# code in rust, where ModInitializer is an external (from library) class type?

namespace MyVeryCoolMod
{
    public class Init : ModInitializer
    {
        ...
    }
}

@FractalFir
Copy link
Owner

FractalFir commented Sep 16, 2024

Are you able to create an equivalent of the following C# code in rust, where ModInitializer is an external (from library) class type?

Yes, and no. This feature is mostly functional, but it is temporarily disabled due to internal refactors.

dotnet_typedef! {
    class Init inherits [Your::External::Assebmly::Name]ModInitializer{

        virtual fn DoSomething(this:Init_){
            panic!()
        },

    }
}

It is something I am working on, but it is currently on the back burner.

Also, defining namespaces is not supported ATM.

@1Tiphereth
Copy link
Author

Alright, as that's what I need in order to initialize my mod after compiling it to a library, which is itself not yet fully supported/done.

@1Tiphereth
Copy link
Author

1Tiphereth commented Sep 17, 2024 via email

@FractalFir
Copy link
Owner

FractalFir commented Sep 18, 2024

Any progress on Library support and the rest?

I have made some improvements to the interop, and I am looking into why you have problems with compiling to dlls.

Still, Windows and using rustc_codegen_clr for modding is not really supported. If I were you, I would not use this project until it is more ready.

BTW, if you are trying to use this for Unity mods, that is not going to work, at least for now. The Unity version of .NET does not support aligned allocators ans 128 bit ints, so all of that is going to need some workarounds.

@1Tiphereth
Copy link
Author

I mean that's the fun of using such experimental tools, it's simply fun to use, as for the unity part how bad is it?

@FractalFir
Copy link
Owner

I mean that's the fun of using such experimental tools, it's simply fun to use, as for the unity part how bad is it?

Sorry for taking a bit to respond. Unity will not load an assembly if it can't find a type it references. So, if a Rust program allocates memory using __rust_alloc(which uses NativeMemory under the hood), uses 128 bits or performs checked math, then it will not be loaded.

Some newer versions of Unity use/will use the CoreCLR runtime. The project should work OK with that runtime.

I have also started working on abstracting 128 bit ints away - adding a 128 bit int will now call a builtin function add_i128, whose implementation can be easily changed. That is the first step towards emulating 128 bit ints.

The implementation of __rust_alloc can also be changed, which should make Mono compatibility easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants