This working for me, but with GCC and mingw 10 on the old stable Debian. I use it to build Linux and Windows versions of my projects. Here is a full command which works for me:
<https://github.com/thindil/nimalyzer/blob/trunk/nimalyzer.nimble#L42> Another possible source of the problem. Some distros think that it is funny to add some hidden arguments to the compilation process (Debian in a good example here). I would check if the problematic argument isn't added somewhere.