Cannot perform x64 build with VS2017 - xcopy fails with 'invalid drive specification' during compiler test
Hi,
I'm hoping this is a simple mistake (still learning cmake), but I've been struggling with this for a couple of weeks now, and I've been able to perform x64 builds previously for libgit2 (which I've used as an example below). Having gone through many posts on the topic, thought it best I raise this for discussion in case others strike the same problem and need help.
With even a simple test project, I get the 'invalid drive specification' error below from xcopy, where it seems a destination hasn't been specified. Yet, the only difference in performing the build is the platform choice. In this case, I'm specifying the VS Win64 generator, but I've also tried using the -A option to leave it up to cmake to find/select the generator.
This is being run in the context of the x64 Native Tools Command Prompt for VS 2017 on Windows 10.
I've reinstalled both VS2017 & cmake while trying various things, so they're up-to-date, and used the latest version of libgit2 for the test below.
Any ideas what I could be doing wrong/try next? Could this be an issue with cmake and/or latest version of VS2017? (due to changes in how/where tools are now located).
Thanks, Kevin
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.7.2
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional>cd C:\test\libgit2
C:\test\libgit2>mkdir build
C:\test\libgit2>cd build
C:\test\libgit2\build>cmake .. -G "Visual Studio 15 2017 Win64"
-- The C compiler identification is MSVC 19.14.26429.4
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/test/libgit2/build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe" "cmTC_a8833.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=15.0"
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 30/05/2018 9:16:42 PM.
Project "C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTC_a8833.dir\Debug\".
Creating directory "C:\test\libgit2\build\CMakeFiles\CMakeTmp\Debug\".
Creating directory "cmTC_a8833.dir\Debug\cmTC_a8833.tlog\".
InitializeBuildStatus:
Creating "cmTC_a8833.dir\Debug\cmTC_a8833.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\CL.exe /c /Zi /W3 /WX- /diagnostics:classic /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_a8833.dir\Debug\\" /Fd"cmTC_a8833.dir\Debug\vc141.pdb" /Gd /TC /FC /errorReport:queue C:\test\libgit2\build\CMakeFiles\CMakeTmp\testCCompiler.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.14.26429.4 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /Zi /W3 /WX- /diagnostics:classic /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_a8833.dir\Debug\\" /Fd"cmTC_a8833.dir\Debug\vc141.pdb" /Gd /TC /FC /errorReport:queue C:\test\libgit2\build\CMakeFiles\CMakeTmp\testCCompiler.c
testCCompiler.c
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\test\libgit2\build\CMakeFiles\CMakeTmp\Debug\cmTC_a8833.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/test/libgit2/build/CMakeFiles/CMakeTmp/Debug/cmTC_a8833.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/test/libgit2/build/CMakeFiles/CMakeTmp/Debug/cmTC_a8833.lib" /MACHINE:X64 /machine:x64 cmTC_a8833.dir\Debug\testCCompiler.obj
cmTC_a8833.vcxproj -> C:\test\libgit2\build\CMakeFiles\CMakeTmp\Debug\cmTC_a8833.exe
PostBuildEvent:
xcopy /y /d "C:\test\libgit2\build\CMakeFiles\CMakeTmp\Debug\*.dll" ""
xcopy /y /d "C:\test\libgit2\build\CMakeFiles\CMakeTmp\Debug\*.pdb" ""
:VCEnd
Invalid drive specification
0 File(s) copied
Invalid drive specification
0 File(s) copied
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: The command "xcopy /y /d "C:\test\libgit2\build\CMakeFiles\CMakeTmp\Debug\*.dll" "" [C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: [C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: xcopy /y /d "C:\test\libgit2\build\CMakeFiles\CMakeTmp\Debug\*.pdb" "" [C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: [C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: :VCEnd" exited with code 4. [C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj]
Done Building Project "C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj" (default target) (1) ->
(PostBuildEvent target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: The command "xcopy /y /d "C:\test\libgit2\build\CMakeFiles\CMakeTmp\Debug\*.dll" "" [C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: [C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: xcopy /y /d "C:\test\libgit2\build\CMakeFiles\CMakeTmp\Debug\*.pdb" "" [C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: [C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: :VCEnd" exited with code 4. [C:\test\libgit2\build\CMakeFiles\CMakeTmp\cmTC_a8833.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.55
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:14 (PROJECT)
-- Configuring incomplete, errors occurred!
See also "C:/test/libgit2/build/CMakeFiles/CMakeOutput.log".
See also "C:/test/libgit2/build/CMakeFiles/CMakeError.log".
C:\test\libgit2\build>