Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nim 1.6.6 not generating Windows Executable #19872

Closed
ikzettel opened this issue Jun 9, 2022 · 5 comments
Closed

Nim 1.6.6 not generating Windows Executable #19872

ikzettel opened this issue Jun 9, 2022 · 5 comments

Comments

@ikzettel
Copy link

ikzettel commented Jun 9, 2022

I have a fresh installation of Nim on Windows 10 64 bit system. While the installation is fine, trying to compile a simple hello.nim is not working. I see that the executable is not getting generated.

hello.nim

echo "Hello, World"

Compile command

nim c -r hello.nim
Hint: used config file 'C:\tools\Nim\nim-1.6.6\config\nim.cfg' [Conf]
Hint: used config file 'C:\tools\Nim\nim-1.6.6\config\config.nims' [Conf]
.........................................................
Hint:  [Link]
Hint: gc: refc; opt: none (DEBUG BUILD, `-d:release` generates faster code)
26671 lines; 0.586s; 31.668MiB peakmem; proj: D:\TBS\workspace\nimlearn\hello.nim; out: D:\TBS\workspace\nimlearn\hello.exe [SuccessX]
Hint: D:\TBS\workspace\nimlearn\hello.exe  [Exec]
oserr.nim(95)            raiseOSError
Error: unhandled exception: Access is denied.
 [OSError]

While checking the directory, the executable is not generated.

nim and gcc are in path, and can be invoked. gcc can compile c programs and has been verified.

$ nim -v
Nim Compiler Version 
Nim Compiler Version 1.6.6 [Windows: amd64]
Compiled at 2022-05-05
Copyright (c) 2006-2021 by Andreas Rumpf
@Araq
Copy link
Member

Araq commented Jun 9, 2022

Disable your antivirus software and check the file/directory permissions.

@ikzettel
Copy link
Author

ikzettel commented Jun 9, 2022

@Araq Unfortunately I don't have privilege to disable anti-virus software. But for file / directory permission there is no issue. I have full access. May I know how antivirus software has anything to do here, knowing that would help me to look for some workaround.

@rockcavera
Copy link
Contributor

@ikzettel , when compiled without -r, is the .exe in the folder? nim c hello.nim?

You installed Nim how? Where did you download mingw from? Could you try different gcc options?

You can try compiling with clang, tcc or vcc too.

Antivirus are marking Nim executables as false positives (see https://forum.nim-lang.org/t/7885). I've heard it's a problem with MinGW. But I've already managed to reproduce false positive with just a "hello world" in C, compiling with mingw.

@rockcavera
Copy link
Contributor

@ikzettel, you can test this compiler here. I did some tests with several versions of mingw64 and this version, with gcc 6.4.0, was the one that generated the least false positives within the Nim compiler tools (devel did not generate any false positives and 1.6.6 generated only in nimgrab - see this). I also tested vcc, llvm(clang), llvm-mingw(clang) and tdm64-gcc but they all generated false positives. I wasted a long time recompiling (18 times) Nim and its tools for windows...

@Elementals
Copy link

So the output shows that the nim compiler does not have permission to write to your D disk.
Try opening cmd or powershell as administrator and then compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants