Stream: beginners

Topic: Benchmarks on windows


view this post on Zulip J.Teeuwissen (Dec 20 2022 at 10:01):

I followed the installation instructions (building from source for windows) and am now trying to run the benchmarks.

If I run cargo bench the benchmarks panic on the ":hammer: Rebuilding platform..." error output from crates\cli_utils\src\bench_utils.rs:23:9.
When I comment this out (just to see what happens) the tests do run, but fail with "Stack Overflow Segmentation fault" for cfold or "extern function roc_mmap is not defined by the builtin" for the list_map benchmark. Any ideas as to why this is happening?

view this post on Zulip Anton (Dec 20 2022 at 10:14):

Here is the README for running the benchmarks. On linux we change the stack size for the cfold benchmark, but I don't think that can be done easily on windows, I think we have code to skip the cfold benchmark on windows but perhaps something goes wrong there when trying to bench with cargo instead of criterion. I've never seen the list_map failure before. We do intend to run the benchmarks on windows CI as well in the future but I haven't gotten to it yet.

view this post on Zulip J.Teeuwissen (Dec 20 2022 at 15:24):

I tried to move to wsl2. Now if I try to cargo test I receive
error[E0554]: #![feature] may not be used on the stable release channel

but if I run cargo +nightly test I get /usr/bin/ld: cannot find -lz: No such file or directory linking with 'cc' failed: exit status: 1.
this is after (and before) running nix develop. Any idea why?

view this post on Zulip Folkert de Vries (Dec 20 2022 at 15:47):

on windows, we need the nightly toolchain for our custom linker to work

view this post on Zulip Folkert de Vries (Dec 20 2022 at 15:47):

basically, on windows the names of exposed functions are stripped, and we need to force rust to keep them

view this post on Zulip Folkert de Vries (Dec 20 2022 at 15:48):

rustup toolchain install nightly should take care of it

view this post on Zulip Folkert de Vries (Dec 20 2022 at 15:48):

I also think I have a fix for that mmap problem somewhere

view this post on Zulip Anton (Dec 20 2022 at 16:05):

Folkert de Vries said:

on windows, we need the nightly toolchain for our custom linker to work

Hmm, the use of nightly in link.rs is behind if cfg!(windows), that should not be triggered in WSL right?

@J.Teeuwissen did you do cargo clean before doing nix develop? If you ran cargo without nix develop earlier, things can get mixed up in the cache.

view this post on Zulip Folkert de Vries (Dec 20 2022 at 16:10):

right. it looks like the targets get messed up somehow

view this post on Zulip J.Teeuwissen (Dec 20 2022 at 16:12):

@Anton , Hi after opening the terminal:

cargo clean
nix develop
cargo test

gives

error: linking with `cc` failed: exit status: 1
collect2: error: ld returned 137 exit status

Additionally, running on plain windows (with nightly) gives me the following error:

thread 'main' has overflowed its stack
Exception 0xc00000fd encountered at address 0x7ff790756a07

view this post on Zulip Anton (Dec 20 2022 at 16:14):

For error: linking with cc... is that the complete error? I think I remember seeing substantially longer variations of that error

view this post on Zulip J.Teeuwissen (Dec 20 2022 at 16:17):

No it's not. It outputs about 200kb of command calls with environment info.

perhaps

 note: /nix/store/2bg235ac1s6cpxwr1pjagn6bj8q2425l-gcc-wrapper-11.3.0/bin/ld: line 256: 22984 Killed
 /nix/store/pmgnlnbygb95s4zc8sqhknz9sdz934pk-binutils-2.39/bin/ld ${extraBefore+"${extraBefore[@]}"} ${params+"${params[@]}"} ${extraAfter+"${extraAfter[@]}"}
          collect2: error: ld returned 137 exit status

tells you more.

view this post on Zulip Anton (Dec 20 2022 at 16:29):

Yeah, I'm going to have to reproduce that locally and really dive into it. I'm taking 10 days off soon so I won't be able to look at it for a bit.
Meanwhile, if you're willing to go through the trouble; setting up Ubuntu 22.04 on VirtualBox should work flawlessly.

view this post on Zulip Anton (Jan 07 2023 at 17:24):

@J.Teeuwissen I was unable to reproduce this using the latest main, and using wsl through Ubuntu 22.04.1 LTS from the Microsoft store.
cargo test --release succeeded, there was an error with cargo test but it was different from what you encountered.

view this post on Zulip J.Teeuwissen (Jan 10 2023 at 14:36):

cargo test --release runs fine, but running cargo test (on the same ubuntu version)
still gives me error: linking with cc failed: exit status: 1, with main being up to date.

view this post on Zulip J.Teeuwissen (Jan 10 2023 at 14:37):

Some more info from the console:

= note: /nix/store/2bg235ac1s6cpxwr1pjagn6bj8q2425l-gcc-wrapper-11.3.0/bin/ld: line 256: 32286 Killed                  /nix/store/pmgnlnbygb95s4zc8sqhknz9sdz934pk-binutils-2.39/bin/ld ${extraBefore+"${extraBefore[@]}"} ${params+"${params[@]}"} ${extraAfter+"${extraAfter[@]}"}
          collect2: error: ld returned 137 exit status

view this post on Zulip Anton (Jan 10 2023 at 15:13):

Hmm, strange, I'll take another look tomorrow

view this post on Zulip Anton (Jan 11 2023 at 17:53):

I'm probably not going to be done with this today @J.Teeuwissen, I hope to finish it on friday

view this post on Zulip Anton (Jan 14 2023 at 13:57):

Are you on windows 11 @J.Teeuwissen?

view this post on Zulip Anton (Jan 14 2023 at 15:13):

Can you also tell me how much RAM you have? I've read about one case where it was suspected that not having enough RAM available was the cause of a linking with cc failed. For my test build all 32GB of RAM were used, WSL also seems to be really bad at cleaning up memory.

view this post on Zulip Folkert de Vries (Jan 14 2023 at 15:14):

wow what is it doing? 32GB is wild

view this post on Zulip Anton (Jan 14 2023 at 15:37):

I was wondering that too :p
I'll check how much memory it uses on NixOS

view this post on Zulip Anton (Jan 14 2023 at 15:44):

On NixOS, I'd guess the average memory usage was about 2GiB but it did go up to 14GiB at one point when building roc crates.

view this post on Zulip Anton (Jan 14 2023 at 15:59):

Someone else has encountered this behavior as well with cargo and reported an issue but no one from Microsoft has replied.

view this post on Zulip J.Teeuwissen (Jan 20 2023 at 06:51):

Anton said:

Are you on windows 11 J.Teeuwissen?

Yes i am

view this post on Zulip J.Teeuwissen (Jan 20 2023 at 06:51):

Anton said:

Can you also tell me how much RAM you have? I've read about one case where it was suspected that not having enough RAM available was the cause of a linking with cc failed. For my test build all 32GB of RAM were used, WSL also seems to be really bad at cleaning up memory.

16 gb

view this post on Zulip Anton (Jan 20 2023 at 08:27):

Yeah, the lack of RAM could be the problem. I don't know how to debug this further but as long as cargo test --release works I believe you are not blocked on anything? I will also be setting up more CI test for native windows soon, which should bring us closer to supporting nightly roc releases for windows.


Last updated: Jul 06 2025 at 12:14 UTC