In Nim's docs declared cross compilation from Linux to Windows with Mingw toolchain https://nim-lang.org/docs/nimc.html#crossminuscompilation-for-windows But this not work, returned linking error
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
....
Hint: [Link]
/usr/lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/bin/ld: unrecognized option '-z'
/usr/lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
Error: execution of an external program failed: '/usr/bin/x86_64-w64-mingw32-gcc -o /tmp/hello.exe /home/user/.cache/nim/hello_d/stdlib_io.nim.c.o /home/user/.cache/nim/hello_d/stdlib_system.nim.c.o /home/user/.cache/nim/hello_d/@mhello.nim.c.o -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
I'm found this answer https://stackoverflow.com/questions/55418931/ld-exe-unrecognized-option-z
It appears that the -z options are just not supported for Windows gcc/ld (at least not for my version). My guess is that the options here are really only meaningful on Linux. This brings me to the -z execstack option (not the Linux tool of the same name), which tells ld to turn off Data Execution Prevention (DEP) on the program. This is done with flags in an ELF executable.
But I can't find linking options for Mingw in Nim source code.