Hi, As the title says I wanted to compile a windows executable from my Linux machine, so I followed the User Guide found here and its written that I need to use the mingw-w64 package that I installed on my system, an arch linux one, but I got an error while compiling with nim c -d:mingw myproject.nim.
Here's the complete output I got:
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
..........................CC: stdlib_assertions.nim
CC: stdlib_widestrs.nim
CC: stdlib_io.nim
CC: stdlib_system.nim
CC: stdlib_math.nim
CC: ../../../../.nimble/pkgs/nigui-0.2.5/nigui/private/windows/windows.nim
CC: stdlib_unicode.nim
CC: stdlib_strutils.nim
CC: stdlib_pathnorm.nim
CC: stdlib_dynlib.nim
CC: stdlib_winlean.nim
CC: stdlib_times.nim
CC: stdlib_os.nim
CC: stdlib_tables.nim
CC: ../../../../.nimble/pkgs/nigui-0.2.5/nigui.nim
CC: ../../../../.nimble/pkgs/nigui-0.2.5/nigui/msgbox.nim
CC: stdlib_browsers.nim
CC: anniv.nim
Hint: [Link]
/usr/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: unrecognized option '-z'
/usr/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: use the --help option for usage information
collect2: erreur: ld a retourné le statut de sortie 1
Error: execution of an external program failed: '/usr/bin/x86_64-w64-mingw32-gcc -o /home/gabriel/Bureau/NIM/guiapp/anniv/anniv.exe /home/gabriel/.nimble/pkgs/nigui-0.2.5/nigui/private/windows/res/amd64.o /home/gabriel/.cache/nim/anniv_d/stdlib_assertions.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_widestrs.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_io.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_system.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_math.nim.c.o /home/gabriel/.cache/nim/anniv_d/@m..@s..@s..@[email protected]@[email protected]@snigui@sprivate@[email protected] /home/gabriel/.cache/nim/anniv_d/stdlib_unicode.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_strutils.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_pathnorm.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_dynlib.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_winlean.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_times.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_os.nim.c.o /home/gabriel/.cache/nim/anniv_d/stdlib_tables.nim.c.o /home/gabriel/.cache/nim/anniv_d/@m..@s..@s..@[email protected]@[email protected]@snigui.nim.c.o /home/gabriel/.cache/nim/anniv_d/@m..@s..@s..@[email protected]@[email protected]@[email protected] /home/gabriel/.cache/nim/anniv_d/stdlib_browsers.nim.c.o /home/gabriel/.cache/nim/anniv_d/@manniv.nim.c.o -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
Here are mu system infos: Linux Gabriel-PC 5.11.13-zen1-1-zen #1 ZEN SMP PREEMPT Sat, 10 Apr 2021 20:47:18 +0000 x86_64 GNU/Linux Please note that Im using latest nim version. If you want the code just ask.
Maybe, but that throw an other error that I don't want to fix
Oh and If I want to cross-compile it's because no one else than me uses Linux, so when I want to share something I made, I need to compile it for windows
Not sure why you'd want to set up your entire Nim environment under Wine just to cross-compile.
You make it sound like it's lots of work -- it's not. In my experience, it's much simpler than cross-compiling. Plus then you can test your program too, which is never a disadvantage, wether you have a professional QA team or not.
Installing Nim under wine, with nimble, and all the packages and keeping all that up to date is definitely more work than just having another compiler installed and a Windows target in your nimble/make file.. I can test my program under Wine or in a VM without having to set anything up when cross compiling. I definitely find it easier to do it that way..
What is the error thrown? You might have to fix it to build on Windows..