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

Visual Studio 2019 Building Problem #3893

Closed
wschin opened this issue Jun 20, 2019 · 5 comments · Fixed by #3894 or #3896
Closed

Visual Studio 2019 Building Problem #3893

wschin opened this issue Jun 20, 2019 · 5 comments · Fixed by #3894 or #3896

Comments

@wschin
Copy link
Member

wschin commented Jun 20, 2019

I got a clean machine and installed the latest Visual Studio 2019. After calling .\build.cmd, I got the following error message.

  "Repos\machinelearning\bin\obj\x64.Debug\Native\INSTALL.vcxproj" (rebuild target) (1) ->
  "Repos\machinelearning\bin\obj\x64.Debug\Native\ALL_BUILD.vcxproj" (default target) (3:2) ->
  "Repos\machinelearning\bin\obj\x64.Debug\Native\SymSgdNative\SymSgdNative.vcxproj" (default target) (10:2) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(429,5): error MSB6006: "CL.exe" exited with code 2. [Repos\machinelearning\bin\obj\x64.Debug\Native\SymSgdNative\SymSgdNative.vcxproj] [Repos\machinelearning\src\Native\build.proj]

Did I do something naïve? To resolve that bug, I remove one line below the it works.

diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt
index a814277e..87b0606c 100644
--- a/src/Native/CMakeLists.txt
+++ b/src/Native/CMakeLists.txt
@@ -21,8 +21,6 @@ if(WIN32)
     add_compile_options($<$<CONFIG:Debug>:/MTd>) # /MT will static link the VC runtime library, so it doesn't need to be installed on the target machine
     add_compile_options($<$<CONFIG:Release>:/MT>)
     add_compile_options($<$<CONFIG:RelWithDebInfo>:/MT>)
-    add_compile_options(/guard:cf)
     add_compile_options(/d2Zi+) # make optimized builds debugging easier
     add_compile_options(/nologo) # Suppress Startup Banner
     add_compile_options(/W3) # set warning level to 3
     add_compile_options(/WX) # treat warnings as errors
@@ -46,9 +44,6 @@ if(WIN32)
@codemzs
Copy link
Member

codemzs commented Jun 20, 2019

Are you using latest version of CMAKE?

@wschin
Copy link
Member Author

wschin commented Jun 20, 2019

Yes. Version 3.14.

@wschin
Copy link
Member Author

wschin commented Jun 20, 2019

According VS document, this is the root cause

The /guard:cf option is incompatible with /ZI (Edit and Continue debug information) or /clr (Common Language Runtime Compilation).

@harishsk
Copy link
Contributor

I am working on a fix.

@harishsk
Copy link
Contributor

We should not remove the /guard:cf flag as that is a security related flag. The right fix is to disable the Edit and Continue (/ZI) flag. I have submitted a pull request for this fix.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants