I'm trying to use wine as an alternative to firing up a windows VM (eg via osx parallels) when I need to test some nim PR affecting windows, since parallels for example is very resource intensive and the windows command line isn't pleasant.
according to https://wiki.winehq.org/MacOS, Wine won't work on macOS Catalina 10.15 however this seems to work: https://apple.stackexchange.com/questions/373851/how-to-get-wine-working-on-catalina brew install homebrew/cask-versions/wine-devel (but only for 64 bit binaries)
after i downloaded https://nim-lang.org/install_windows.html (64 bit), some things work, eg:
(after blessing such binaries in osx system preferences>security and privacy>allow apps downloaded from>allow blacklisted app appearing there)
>>> echo defined(windows)
true
>>> import os
shows lots of errors:
Z:\Users\timothee\Downloads\nim-1.4.2\lib\pure\os.nim(825, 16) Error: undeclared identifier: 'cmpic'
but still kind of works:
>>> echo parentDir("C:\\foo\\bar")
C:\foo
wine64 /Users/timothee/Downloads/nim-1.4.2/bin/nim.exe c -o:/tmp/z01 --skipparentcfg --skipusercfg $timn_D/tests/nim/all/t11802.nim
Hint: used config file 'Z:\Users\timothee\Downloads\nim-1.4.2\config\nim.cfg' [Conf]
Hint: used config file 'Z:\Users\timothee\Downloads\nim-1.4.2\config\config.nims' [Conf]
....CC: stdlib_io.nim
Error: invocation of external compiler program failed. File not found.
Additional info: "Requested command not found: \'gcc.exe -c -w -fmax-errors=3 -mno-ms-bitfields -IZ:\\Users\\timothee\\Downloads\\nim-1.4.2\\lib -IZ:\\Users\\timothee\\git_clone\\nim\\timn\\tests\\nim\\all -o C:\\users\\timothee\\nimcache\\t11802_d\\stdlib_io.nim.c.o C:\\users\\timothee\\nimcache\\t11802_d\\stdlib_io.nim.c\'. OS error:" 2
What am I missing here to make it work?
thanks, but the problem is how to get gcc.exe in the 1st place, on a non-windows platform (eg on OSX):
wine64 winepath -w /Users/timothee/Downloads/nim-1.4.2/bin
Z:\Users\timothee\Downloads\nim-1.4.2\bin
WINEPATH="Z:\Users\timothee\Downloads\nim-1.4.2\bin" wine64 /Users/timothee/Downloads/nim-1.4.2/bin/nim.exe c -o:/tmp/z01 --skipparentcfg --skipusercfg /pathto/main.nim
CC: stdlib_io.nim
Error: invocation of external compiler program failed. File not found.
Additional info: "Requested command not found: \'gcc.exe -c -w -fmax-errors=3 -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN -IZ:\\Users\\timothee\\Downloads\\nim-1.4.2\\lib -IZ:\\Users\\timothee\\git_clone\\nim\\timn\\tests\\nim\\all -o C:\\users\\timothee\\nimcache\\t12357_d\\stdlib_io.nim.c.o C:\\users\\timothee\\nimcache\\t12357_d\\stdlib_io.nim.c\'. OS error:" 2
if i add --cc:vcc i get:
Hint: vcvarsall.bat was not found
oserr.nim(94) raiseOSError
Error: unhandled exception: File not found.
Additional info: "Requested command not found: \'cl.exe\'. OS error:" [OSError]
I just used choosenim which after running allows me to compile
how do you use it for getting windows binaries on non-windows host? eg ~/.choosenim/toolchains/nim-1.4.2/bin only contains non-windows binaries
note that I'm making some progress as follows: brew install mingw-w64
after that i can compile at least c,cpp files, eg:
/usr/local/opt/mingw-w64/toolchain-x86_64/bin/x86_64-w64-mingw32-g++ -o /tmp/z01x /tmp/z02.cpp
wine64 /tmp/z01x.exe # works
but still not there yet
finally got it to work!
CC=/usr/local/opt/mingw-w64/toolchain-x86_64/bin/x86_64-w64-mingw32-gcc $nimb c --os:windows --lib:lib --cc:env --nimcache:/tmp/c02 -f $timn_D/tests/nim/all/t12357.nim
(requires a small compiler patch; will make a PR soon)