I want to generate Visual Studio files by this instructions, and when I use the commands:
mkdir build
cd build
cmake -G "Visual Studio 14 2015 Win64" ..
it says :
CMake Error at CMakeLists.txt:44 <project>:
Failed to run MSBuild command:
c:/Program files <x86>/MSBuild/14.0/bin/MSBuild.exe
to get the value of VCTargetspath:
Microsoft <R> Build Engine version 14.0.25420.1
Copyright <c? Microsoft Corporation. All rights reserved
MSBUILD : error MSB1009: Project file does not exist.
Switch: VCITargetspath.vcxproj
Exit code: 1
Configuring incomplete, errors occurred!
See also c:/Windows/System32/cpp-ethereum/build/CMakefiles/CMakeOutput.log
and also when I use the alt command:
cmake --build . --config RelWithDebInfo
it says:
MSBUILD : error MSB1009: Project file does not exist.
Switch: ALL_BUILD.vcxproj
I have to note that I have git, CMake and Visual Studio 2015 Professional fully installed.
Related
I have a C++ project which is built with Visual Studio 2019. I started to get strange build errors in Azure Pipeline in December. Before then, the build test had passed all the time. The build is still fine on my Windows machines. It has issues only in Azure Pipeline. I get this error
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\include\memory(619,23): error C3861: '__iso_volatile_load32': identifier not found [D:\a\1\s\build\ode\raisimODE.vcxproj]
The error message seems like it is looking for ARM instructions. Here is a snippet of my build script
cd $(Build.Repository.LocalPath)
mkdir build
cd build
cmake -Q .. -G "Visual Studio 16 2019" -A x64 -DRAISIM_TEST=ON -DCMAKE_PREFIX_PATH=$(Pipeline.Workspace)\dep\raisim_env
cmake --build . --config Release
ctest -VV -C Release
cd $(Build.Repository.LocalPath)
When i try to build the opencv package in python using command line
PS C:\Program Files\Open_CV\opencv-python> python setup.py build
It throws an error:
Version: 4.3.0+3073e9e
setup.py:85: DeprecationWarning: SO is deprecated, use EXT_SUFFIX
['python/cv2[^/]*%(ext)s' % {'ext': re.escape(sysconfig.get_config_var('SO'))}],
Trying "Visual Studio 14 Win64" generator
Not searching for unused variables given on the command line.
Selecting Windows SDK version to target Windows 10.0.18363.
CMake Error at CMakeLists.txt:2 (PROJECT):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
The system cannot find the file specified
Configuring incomplete, errors occurred!
See also "C:/Program Files/Open_CV/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
Trying "Visual Studio 14 Win64" generator - failure
scikit-build could not get a working generator for your system. Aborting build.
Building windows wheels for Python 3.8 requires Microsoft Visual Studio 2017.
Get it with "Visual Studio 2017":
https://visualstudio.microsoft.com/vs/
They don't automatically detect VS2019 yet. You have to specify the generator.
python setup.py build -G "Visual Studio 16 2019"
I am trying to build a C++ project using Visual Studio 2017 on top of the ICC 19.0 compiler.
This is the command I try to execute:
cmake -G "Visual Studio 15 2017 Win64" -T "Intel C++ Compiler 19.0" ..
This is the error I always get:
CMake Error at CMakeLists.txt:17 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 2019-12-24 15:19:24.
Project "C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.14.props(47,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj]
Done Building Project "C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj" (default target) (1) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.14.props(47,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.08
Exit code: 1
-- Configuring incomplete, errors occurred!
I do have VS2017 build tools installed — and reinstalled several times, for that matter.
What am I doing wrong?
Why is it trying to use VS2015 build tools that I don`t even have?
[UPD:] The result is the same even when I execute this command from x64 Native Tools Command Prompt for VS2017.
Please check whether file "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" is exist.
If the project is ported from VS2015, Please check VisualStudioVersion parameter in your project file (.csproj/.vbproj), such as "C:\Users\user001\Desktop\myproject\build\CMakeFiles\3.16.2\VCTargetsPath.vcxproj".
Visual Studio project compatibility and VisualStudioVersion
Okay, after much chagrin I found out what was happening.
The ICC 19.0 installer misrecognized the version of Visual Studio and installed MSVS 2015 extensions instead of 2017, which led CMake to believe it should use MSVS 2015 build tools which were simply not there.
Problem solved.
All it took to solve this was to choose «Modify» from the ICC installer menu and switch to the right extension set.
Since I'm new to CMake, I've been attempting to set up a basic CMake application using CMake GUI while following this tutorial. Everything worked fine up until the point when I clicked "Configure". I changed Visual Studio 14 2015 to Visual Studio 16 2019 (because I have a more recent version of Visual Studio) and "Hello World" to "Basic", and after clicking "Configure", I received an error telling me the Visual Studio compiler, cl.exe, could not successfully compile a test program. More details below.
I have already created a CMake project using Visual Studio's built in work-space and it has successfully compiled my project; however, this is undesirable to me as Visual Studio adds a bunch of files to my project that make it look more complicated for a beginner and dirty up my project. This tells me that my Visual Studio installation is not defective, and that something is wrong with CMake.
For those that want to know, my CMakeLists.txt looks like this:
cmake_minimum_required(VERSION "3.10")
project("Basic")
add_executable("${PROJECT_NAME}" "main.cpp")
install(TARGETS "${PROJECT_NAME}" DESTINATION bin)
install(FILES "main.cpp" DESTINATION src)
I expect CMake to configure my project correctly like it does for the guy in the tutorial video, but instead I get an error while configuring that says this (Username replaced by "potato" for personal reasons):
Selecting Windows SDK version 10.0.18362.0 to target Windows 6.1.7601.
The C compiler identification is MSVC 19.23.28106.4
The CXX compiler identification is MSVC 19.23.28106.4
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/potato/Desktop/Basic/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_09d22.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.3.1+1def00d3d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(5589,7): error MSB4023: Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)" cannot be applied to the path "#(_DebugSymbolsIntermediatePath->'C:\Users\potato\Desktop\Basic\build\CMakeFiles\CMakeTmp\Debug\%(Filename)%(Extension)')". Illegal characters in path. [C:\Users\potato\Desktop\Basic\build\CMakeFiles\CMakeTmp\cmTC_09d22.vcxproj]
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/potato/Desktop/Basic/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/potato/Desktop/Basic/build/CMakeFiles/CMakeError.log".
CMakeError.log states this:
Determining if the C compiler works failed with the following output:
Change Dir: C:/Users/potato/Desktop/Basic/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_09d22.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.3.1+1def00d3d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(5589,7): error MSB4023: Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)" cannot be applied to the path "#(_DebugSymbolsIntermediatePath->'C:\Users\potato\Desktop\Basic\build\CMakeFiles\CMakeTmp\Debug\%(Filename)%(Extension)')". Illegal characters in path. [C:\Users\potato\Desktop\Basic\build\CMakeFiles\CMakeTmp\cmTC_09d22.vcxproj]
Perhaps I should also note that the real username, replaced by "potato", contains an apostrophe. This may be only minimal, but it could be important as I read the error "Illegal characters in path."
It turns out that the problem in my case is that the username for my computer contains an apostrophe. Definitely a strange bug.
I am trying to build a cuda/c++ program in Visual Studio 2017. It might be worth noting that my computer also has VS 2013 installed. I have tried placing vsvars32.bat in the same directory as it is for VS 2013 but the error did not change. I don't know where it's supposed to go because of the x64/../../..
>------ Build started: Project: CMakeLists, Configuration: Debug ------
[1/5] cmd.exe /C "cd /D "D:\Users\adm_lab\CMakeBuilds\3f75e69e-932c-9435-a942-a027b1514a1d\build\x64-Debug (default)\CMakeFiles\voxelizer.dir" && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E make_directory "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//." && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -D verbose:BOOL=OFF -D build_configuration:STRING=Debug -D "generated_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj" -D "generated_cubin_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj.cubin.txt" -P "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//voxelizer_generated_main.cu.obj.Debug.cmake""
FAILED: CMakeFiles/voxelizer.dir/voxelizer_generated_main.cu.obj
cmd.exe /C "cd /D "D:\Users\adm_lab\CMakeBuilds\3f75e69e-932c-9435-a942-a027b1514a1d\build\x64-Debug (default)\CMakeFiles\voxelizer.dir" && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E make_directory "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//." && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -D verbose:BOOL=OFF -D build_configuration:STRING=Debug -D "generated_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj" -D "generated_cubin_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj.cubin.txt" -P "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//voxelizer_generated_main.cu.obj.Debug.cmake""
nvcc fatal : Visual Studio configuration file 'vsvars32.bat' could not be found for installation at 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/../../..'
CMake Error at voxelizer_generated_main.cu.obj.Debug.cmake:219 (message):
Error generating
D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug
(default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj
ninja: build stopped: subcommand failed.
Build failed.
edit: thought I should add that the computer this is on does not have an internet connection so I used the local cache method outlined here to install VS.
Please, double-check your Visual Studio 2017 instance is up to date. Then repair your Visual Studio instance via the Visual Studio Installer:
Start Visual Studio Installer.
Click the Details icon icon in front of your Visual Studio 2017 installation, and then click Repair.
Read Microsoft Docs | Repair Visual Studio for more information.