MSBuild:错误 MSB3073 命令“setlocal VCEnd”退出,代码为 1

问题描述 投票:0回答:3

我正在尝试使用 Visual Studio 2015 和 CMake 在我的机器上构建一个开源项目。我已按照所有步骤进行操作,预构建检查运行正常。但是当我构建 INSTALL 以将软件安装在我在 CMAKE gui 中指定的文件夹中时,我收到了 MSB3073 错误。错误的完整描述如下。

Severity Code Description Project File Line Suppression State Error 
MSB3073 The command "setlocal
"C:\Program Files (x86)\CMake\bin\cmake.exe" -DBUILD_TYPE=RelWithDebInfo -P    cmake_install.cmake
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1. 
INSTALL C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets  133 

我搜索了同样的错误,发现一些试图在没有写权限的目录中安装构建的人遇到了这个问题,但我已经确保我有写权限。我什至尝试过使用管理员权限执行此操作,但仍然无法解决此问题。

在此方面的任何帮助将不胜感激。

cmake visual-studio-2015 msbuild
3个回答
0
投票

在运行 Visual Studio 2022 时,尝试使用 cmake 生成的代码构建 VST 插件。 对我来说,创建符号链接时显示权限访问被拒绝。

我所要做的就是以“管理员身份”运行 Visual Studio,它就成功了。

当然,您必须拥有机器的管理员权限,或者您属于允许在本地组策略编辑器中“创建符号链接”的组(https://developer.steinberg.help/display/VST /Preparation+on+Windows)


-1
投票

抱歉我是个死灵,但我刚刚遇到并解决了完全相同的问题,我认为如果我分享我的解决方案可以节省一些时间。

通过查看错误消息之前的日志,我找到了 CMake 试图安装的最后一个元素:

-- Installing: path-to-anaconda/anaconda3/Lib/site-packages/cv2.cp37-win_amd64.pyd
CMake Error at modules/python3/cmake_install.cmake:45 (file):
  file INSTALL cannot copy file
  "path-to-repo/opencv/build/lib/python3/Release/cv2.cp37-win_amd64.pyd" to
  "path-to-anaconda/anaconda3/Lib/site-packages/cv2.cp37-win_amd64.pyd":
  Permission denied.
Call Stack (most recent call first):
  modules/cmake_install.cmake:183 (include)
  cmake_install.cmake:124 (include)

权限被拒绝...

这只是因为我留下了一个导入了 cv2 的控制台,所以 pyd 仍在使用并阻止了安装。这可能会扩展到正在安装的任何其他文件(DLL、.hpp),只需看一下这条晦涩的错误消息上方!与

cmake_install.cmake
无关,至少对我而言。


-9
投票

其中一个 cmake_install.cmake 文件中存在错误,这是导致问题的原因。一旦我解决了这个问题,它就奏效了。

© www.soinside.com 2019 - 2024. All rights reserved.