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?
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.
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?
on windows, we need the nightly toolchain for our custom linker to work
basically, on windows the names of exposed functions are stripped, and we need to force rust to keep them
rustup toolchain install nightly
should take care of it
I also think I have a fix for that mmap problem somewhere
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.
right. it looks like the targets get messed up somehow
@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
For error: linking with
cc...
is that the complete error? I think I remember seeing substantially longer variations of that error
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.
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.
@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.
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.
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
Hmm, strange, I'll take another look tomorrow
I'm probably not going to be done with this today @J.Teeuwissen, I hope to finish it on friday
Are you on windows 11 @J.Teeuwissen?
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.
wow what is it doing? 32GB is wild
I was wondering that too :p
I'll check how much memory it uses on NixOS
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.
Someone else has encountered this behavior as well with cargo and reported an issue but no one from Microsoft has replied.
Anton said:
Are you on windows 11 J.Teeuwissen?
Yes i am
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
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