hello just wondering what the plans are or potential roadblocks to getting nim to be used by vcc on windows. I don't see any docs on this but there is obviously the mingw-64 download on the site.
The reason i'm asking is after getting to to "vkCreateCmdPool" in the vulkan api seemingly cannot go further because it seg-faults in nim.
I think it is a problem with the compiler(mingw) not working with the vcc build lib in the sdk. I can't prove that yet so no accusations here. But there are posts on stackoverflow about this.
Anybody got any ideas to make it work better? if not i will wait till nim switches to vcc to work on vulkan. But i do have some c++ code working with vulkan right now, it seems there are slight incompatabilities with mingw and vcc so i have to pick one.
- backup config/nim.cfg
- edit config/nim.cfg (see below, the existing vcc definitions are for a really old compiler)
- compile as nim c --cc:vcc file.nim
# Configuration for the Visual C/C++ compiler: #vcc.exe = "vccexe.exe" vcc.exe = "cl.exe" #vcc.linkerexe = "vccexe.exe" vcc.linkerexe = "link.exe" # set the options for specific platforms: @if i386: #vcc.options.always = "--platform:x86 /nologo" vcc.options.always = "/nologo" #vcc.options.linker = "--platform:x86 /nologo /DEBUG /Zi /F33554432" # set the stack vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB @elif amd64: #vcc.options.always = "--platform:amd64 /nologo" vcc.options.always = "/nologo" #vcc.options.linker = "--platform:amd64 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB @elif arm: vcc.options.always = "--platform:arm /nologo" vcc.options.linker = "--platform:arm /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB @else: vcc.options.always = "/nologo" vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB @end vcc.options.debug = "/Zi /FS /Od" vcc.options.speed = "/O2" vcc.options.size = "/O1"
@Kerp, I occasionally use vcc and mingw64 simultaneously. I don't think there's big different between two.
The different I can say is, when I played around about concurrency in Nim, threadpool module still has implicit bug that it can't run the second spawn when I tried it.
Also, addition to what @jlp765 mentioned, you can supply your additional nim.cfg in your project directory so any additional setting will overwrite default nim.cfg. If you want specific Nim file that use specific setting, you can use yourfile.nim.cfg so the config only apply to your specific file.
My system is running 64-bit Win 10, and already have VS 2017 installed, as well as Nim 0.17. Your vccexe tool seems couldn't find cl.exe
"C:\WINDOWS\system32\cmd.exe" /C "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall && SET" cl.exe Traceback (most recent call last) vccexe.nim(61) vccexe osproc.nim(578) startProcess os.nim(154) raiseOSError Error: unhandled exception: The system cannot find the file specified. Additional info: Requested command not found: 'cl.exe'. OS error: [OSError]
"C:Program Files (x86)Microsoft Visual Studio 14.0VCvcvarsall" does exist, though.
IIRC, I changed vcc.exe option in $NIM/config/nim.cfg to cl.exe.
Every time I want to use vcc compiler, I execute that "vcvarsall.bat" it first and the paths vcc compiler will be added for that console session.
Ah I see. First open Developer Command Prompt for VS 2017. Then on that command prompt, run vccexe
"C:\WINDOWS\system32\cmd.exe" /C "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall && SET" cl.exe Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x86 Copyright (C) Microsoft Corporation. All rights reserved. usage: cl [ option... ] filename... [ /link linkoption... ]
Seems fine. Now the issue is to compile a Hello world program. Calling nim c -r hello.nim gives this:
Hint: used config file 'C:\nim\config\nim.cfg' [Conf] Hint: system [Processing] Hint: hello [Processing] CC: hello CC: stdlib_system hello.c stdlib_system.c C:\nim\lib\nimbase.h(482): error C2118: negative subscript C:\nim\lib\nimbase.h(482): error C2118: negative subscript Hint: [Link] LINK : warning LNK4044: unrecognized option '/Zi'; ignored LINK : warning LNK4044: unrecognized option '/F33554432'; ignored LINK : warning LNK4044: unrecognized option '/FeC:\Users\Cipta-NB\Codes\Nim\hello.exe'; ignored LINK : fatal error LNK1181: cannot open input file 'C:\Users\Cipta-NB\Codes\Nim\nimcache\hello.obj' Error: execution of an external program failed: 'link.exe /nologo /DEBUG /Zi /F33554432 /FeC:\Users\Cipta-NB\Codes\Nim\hello.exe C:\Users\Cipta-NB\Codes\Nim\nimcache\hello.obj C:\Users\Cipta-NB\Codes\Nim\nimcache\stdlib_system.obj '