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

VC++ winnt.h fatal error "No Target Architecture" in stdlib_io. #14259

Closed
treeform opened this issue May 7, 2020 · 6 comments
Closed

VC++ winnt.h fatal error "No Target Architecture" in stdlib_io. #14259

treeform opened this issue May 7, 2020 · 6 comments

Comments

@treeform
Copy link
Contributor

treeform commented May 7, 2020

Getting this error from Visual C++ but it works on Apr 15th compiler so its a very recent change.

# nim cpp --cc:vcc src\main.nim
import net
discard newSocket()
C:\Program Files (x86)\Windows Kits\8.1\include\\um\winnt.h(147): fatal error C1189: #error:  "No Target Architecture"

It looks like this error is related to WIN32_LEAN_AND_MEAN and the order in which one imports <windows.h>. Maybe some thing changed in stdlib_io?

Error: execution of an external compiler program 'vccexe.exe /c --platform:amd64  /nologo /EHsc -DWIN32_LEAN_AND_MEAN -D_GLFW_WIN32 /O2  /IC:\Users\me\.choosenim\toolchains\nim-#devel\lib /IC:\p\src /nologo /FoC:\Users\me\nimcache\main_d\stdlib_io.nim.cpp.obj C:\Users\me\nimcache\main_d\stdlib_io.nim.cpp' failed with exit code: 2
nim -v
Nim Compiler Version 1.3.1 [Windows: amd64]
Compiled at 2020-05-07
Copyright (c) 2006-2020 by Andreas Rumpf

active boot switches: -d:release
.\cl.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.25.28612 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.
@treeform
Copy link
Contributor Author

treeform commented May 7, 2020

This works fine on stable, its a regression in devel.

Nim Compiler Version 1.2.0 [Windows: amd64]
Compiled at 2020-04-03
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: 7e83adff84be5d0c401a213eccb61e321a3fb1ff
active boot switches: -d:releasev```

@treeform
Copy link
Contributor Author

treeform commented May 8, 2020

I did a little more digging around:

May 8 #ce16115e790b4fcd6076d0d0f0024a11ce15a2b7
	stdlib_io.nim.cpp winnt.h(147): fatal error C1189: #error:  "No Target Architecture"

May07
	my #devel 
	stdlib_io.nim.cpp winnt.h(147): fatal error C1189: #error:  "No Target Architecture"

Apr28 #545239b791c3abea95a192ea50419b66ba29fb86
	fixed '_umul128' error but now
	stdlib_io.nim.cpp winnt.h(147): fatal error C1189: #error:  "No Target Architecture"

Arp20 #6bd279c97871e47c78636f3c1a8f39a7915b1402
	hashes.nim(102): error C3861: '_umul128': identifier not found

Apr15 #3a2697dd731cb8fcfd0d279bb856090eca5028ee
	works

Apr 4 #813ed358bfe7c282e9adc81bdd7f8a9ff2dc17b9
	works 

Apr 2 #7e83adff84be5d0c401a213eccb61e321a3fb1ff 
	1.20 stable works

@treeform
Copy link
Contributor Author

Looks like this bug was fixed with Nim 1.2.2 https://nim-lang.org/blog/2020/06/17/version-122-released.html

@bobeff
Copy link
Contributor

bobeff commented Sep 25, 2020

This bug is still present with the latest develop branch. It is reproducible with both MSVC and Clang for Windows.

λ nim --version
Nim Compiler Version 1.3.7 [Windows: amd64]
Compiled at 2020-09-25
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: 2aa7cd406cf5a8a8a4825ff5480a78c5901eb6e9
active boot switches: -d:release -d:danger
λ gcc --version
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
λ clang --version
clang version 10.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin

@alehander92 alehander92 reopened this Sep 25, 2020
@darkr4y
Copy link

darkr4y commented Nov 27, 2020

also have this issue

nim --version
Nim Compiler Version 1.4.0 [Windows: amd64]
Compiled at 2020-10-18
Copyright (c) 2006-2020 by Andreas Rumpf

active boot switches: -d:release

I want to static link openssl library which installed by vcpkg, build command

nim c --cc:vcc --os:windows --cpu:amd64 -d:release -d:ssl -p:. --clibdir:C:\vcpkg\installed\x64-windows-static\lib\ --cincludes:C:\vcpkg\installed\x64-windows-static\include\openssl --dynlibOverride:ssl --passl:-lcrypto --passl:-lssl test.nim

errors

Error: execution of an external compiler program 'vccexe.exe /c --platform:amd64  /nologo -DWIN32_LEAN_AND_MEAN   /IC:\Users\xxx\scoop\apps\nim\current\lib /IC:\vcpkg\installed\x64-windows-static\include\openssl /IC:\Users\xxx\Desktop\NimPlayground /nologo /FoC:\Users\xxx\nimcache\test_d\stdlib_io.nim.c.obj C:\Users\xxx\nimcache\test_d\stdlib_io.nim.c' failed with exit code: 2

@rockcavera
Copy link
Contributor

This bug is still present today, both in the clang compiler, vcc and tcc. It was introduced by the commit

@Araq Araq closed this as completed in d15f63a Dec 12, 2020
narimiran pushed a commit that referenced this issue Dec 19, 2020
* IPv6 text representation according to RFC 5952

* Revert IPv6 text representation according to RFC 5952

* fix #14259 #15621

fix #14259 #15621

* Update lib/system/io.nim

* reverted IoHandle removal

* adaptation of types for WinAPI

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
(cherry picked from commit d15f63a)
mildred pushed a commit to mildred/Nim that referenced this issue Jan 11, 2021
* IPv6 text representation according to RFC 5952

* Revert IPv6 text representation according to RFC 5952

* fix nim-lang#14259 nim-lang#15621

fix nim-lang#14259 nim-lang#15621

* Update lib/system/io.nim

* reverted IoHandle removal

* adaptation of types for WinAPI

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
* IPv6 text representation according to RFC 5952

* Revert IPv6 text representation according to RFC 5952

* fix nim-lang#14259 nim-lang#15621

fix nim-lang#14259 nim-lang#15621

* Update lib/system/io.nim

* reverted IoHandle removal

* adaptation of types for WinAPI

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
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

7 participants