Winodws10 VS2019 Clion CMake 编译 OpenCV rc 系统找不到指定的文件。NMAKE : fatal error U1077
在從源碼編譯開(kāi)源庫(kù)這條路上,怎么這么多坑給我踩?
這次是編譯 OpenCV。
簡(jiǎn)單總結(jié)
在 Windows10 系統(tǒng)下,使用 VS2019 編譯鏈,在 Clion 編譯 OpenCV 時(shí),出現(xiàn)報(bào)錯(cuò),報(bào)錯(cuò)的關(guān)鍵信息:
Detecting C compiler ABI info - failed rc 系統(tǒng)找不到指定的文件。NMAKE : fatal error U1077解決方案
指定 CMake 編譯的目標(biāo)平臺(tái)/架構(gòu)(platform/architecture),指定方式:
cmake -G "Visual Studio 16 2019" -A Win32cmake -G "Visual Studio 16 2019" -A x64cmake -G "Visual Studio 16 2019" -A ARMcmake -G "Visual Studio 16 2019" -A ARM64痛苦回顧
來(lái)看看咱的報(bào)錯(cuò)信息
Microsoft Windows [版本 10.0.19043.1320] (c) Microsoft Corporation。保留所有權(quán)利。C:\Workspace\CLion\opencv_next_test>cd buildC:\Workspace\CLion\opencv_next_test\build>"C:\Software\JetBrains\CLion 2021.1.1\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_DEPENDS_USE_COMPILER=FALSE -G "CodeBlocks - NMake Makefiles" ../ -- The C compiler identification is MSVC 19.29.30136.0 -- The CXX compiler identification is MSVC 19.29.30136.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - broken CMake Error at C:/Software/JetBrains/CLion 2021.1.1/bin/cmake/win/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):The C compiler"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"is not able to compile a simple test program.It fails with the following output:Change Dir: C:/Workspace/CLion/opencv_next_test/build/CMakeFiles/CMakeTmpRun Build Command(s):nmake -f Makefile /nologo cmTC_f9517\fast && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\nmake.exe" -f CMakeFiles\cmTC_f9517.dir\build.make /nologo -L CMakeFiles\cmTC_f9517.dir\buildBuilding C object CMakeFiles/cmTC_f9517.dir/testCCompiler.c.obj"C:\Software\JetBrains\CLion 2021.1.1\bin\cmake\win\bin\cmake.exe" -E cmake_cl_compile_depends --dep-file=CMakeFiles\cmTC_f9517.dir\testCCompiler.c.obj.d --working-dir=C:\Workspace\CLion\opencv_next_test\build\CMakeFiles\CMakeTmp --filter-prefix="" -- C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe @C:\Users\ruan\AppData\Local\Temp\nm6CB6.tmpLinking C executable cmTC_f9517.exe"C:\Software\JetBrains\CLion 2021.1.1\bin\cmake\win\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_f9517.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_f9517.dir\objects1.rsp @C:\Users\ruan\AppData\Local\Temp\nm6D92.tmpRC Pass 1: command "rc /fo CMakeFiles\cmTC_f9517.dir/manifest.res CMakeFiles\cmTC_f9517.dir/manifest.rc" failed (exit code 0) with the following output:系統(tǒng)找不到指定的文件。NMAKE : fatal error U1077: “"C:\Software\JetBrains\CLion 2021.1.1\bin\cmake\win\bin\cmake.exe"”: 返回代碼“0xffffffff”Stop.NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\nmake.exe"”: 返回代碼“0x2”Stop.CMake will not be able to correctly generate this project. Call Stack (most recent call first):CMakeLists.txt:2 (project)-- Configuring incomplete, errors occurred! See also "C:/Workspace/CLion/opencv_next_test/build/CMakeFiles/CMakeOutput.log". See also "C:/Workspace/CLion/opencv_next_test/build/CMakeFiles/CMakeError.log".C:\Workspace\CLion\opencv_next_test\build>
關(guān)鍵是
Detecting C compiler ABI info - failed
和
rc 系統(tǒng)找不到指定的文件。NMAKE : fatal error U1077
根據(jù)jetbrains的說(shuō)法,這不是他們的鍋。
無(wú)論是在命令行還是在Clion里面都這樣,但是好奇的是在 Visual Studio 2019 里面卻沒(méi)事?
然后,確實(shí)找不到 rc
C:\Workspace\CLion\opencv_next_test\build>where rc.exe 信息: 用提供的模式無(wú)法找到文件。難道是 VS2019 里面有一些配置好的環(huán)境變量?
通過(guò)查找網(wǎng)上一堆 rc 和無(wú)法確定編譯器的問(wèn)題
Error: The C compiler is not able to compile a simple test program.
rc.exe no longer found in VS 2015 Command Prompt
Windows compilation error: Missing rc.exe
…
然鵝他們都不起作用,就算能找到rc,也會(huì)說(shuō)找不到某些頭文件。
停下來(lái)理一下思路,OpenCV編譯失敗,因?yàn)闆](méi)有成功檢測(cè)編譯器的信息,原因是檢測(cè)時(shí)找不到rc發(fā)生了中斷。
那會(huì)不會(huì)是某些編譯參數(shù)影響了呢?排查了一下,發(fā)現(xiàn)用下面這個(gè)參數(shù)編譯就會(huì)出問(wèn)題
cmake -G "CodeBlocks - NMake Makefiles" ../好,VS2019用的應(yīng)該是Visual Studio 16 2019,那就改一下唄。
根據(jù) CMake 的 文檔,改成
cmake -G "Visual Studio 16 2019" ../成功了~
補(bǔ)一張 CLion 設(shè)置 CMake 參數(shù)的圖
在
CLion --> File --> Settings --> Build,Execution,Deployment --> CMake --> Release/Debug --> CMake options
添加
總結(jié)
以上是生活随笔為你收集整理的Winodws10 VS2019 Clion CMake 编译 OpenCV rc 系统找不到指定的文件。NMAKE : fatal error U1077的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Windows10 编译 Open3D
- 下一篇: 嵌入式实时操作系统的基本概念——μ/CO