简体   繁体   English

MinGW Make throw“系统无法找到指定的路径。”错误

[英]MinGW Make throwing “The system cannot find the path specified.” error

I'm trying to generate a c++ project using cmake on Windows 7. Before it actually makes the project though it looks cmake does a quick test of your toolchain (I'm using MinGW) and that's where my problem. 我正在尝试在Windows 7上使用cmake生成一个c ++项目。在实际制作项目之前,看起来cmake会快速测试你的工具链(我正在使用MinGW),这就是我的问题所在。 Cmake triggers a make build which ultimately fails with the response "The system cannot find the path specified." Cmake触发make build,最终因响应“系统无法找到指定的路径”而失败。

I ran the particular makefile that was failing in dry run mode (-n) and manually executed all the commands: 我运行了在干运行模式下失败的特定makefile(-n)并手动执行了所有命令:

"C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_progress_report C:\SFML\CMakeFiles\CMakeTmp\CMakeFiles 1

echo Building C object CMakeFiles/cmTryCompileExec306416588.dir/testCCompiler.c.obj

C:\PROGRA~2\CODEBL~1\MinGW\bin\gcc.exe    -o CMakeFiles\cmTryCompileExec306416588.dir\testCCompiler.c.obj   -c C:\SFML\CMakeFiles\ CMakeTmp\testCCompiler.c

echo Linking C executable cmTryCompileExec306416588.exe

"C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTryCompileExec306416588.dir\link.txt --verbose=1

And they all executed without error leaving me with a functional .exe file as expected. 他们都没有错误地执行,留下了一个功能正常的.exe文件。 However when run through make I return the error: 但是当运行make时我返回错误:

"C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_progress_report C:\SFML\CMakeFiles\CMakeTmp\CMakeFiles 1

The system cannot find the path specified.

mingw32-make.exe: *** [CMakeFiles/cmTryCompileExec306416588.dir/testCCompiler.c.obj] Error 1

I then experimented with replacing all of the commands with something simple like "dir" and noticed that when run through make is returned "The system cannort find the path specified" again before printing out the dir information and exiting with an error. 然后我尝试用简单的“dir”替换所有命令,并注意到在运行make时返回“系统canort再次找到指定的路径”,然后打印出dir信息并退出并显示错误。

My next step, and about as far as I've gotten, is to run make with the -d flag; 我的下一步,就我所知,是使用-d标志运行make; the interesting bit being: 有趣的是:

Creating temporary batch file C:\Users\CJ\AppData\Local\Temp\make8664-1.bat
Batch file contents:
    @echo off
    "C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_progress_report C:\SFML\CMakeFiles\CMakeTmp\CMakeFiles 1
"C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_progress_report C:\SFML\CMakeFiles\CMakeTmp\CMakeFiles 1
CreateProcess(C:\Users\CJ\AppData\Local\Temp\make8664 1.bat,C:\Users\CJ\AppData\Local\Temp\make8664-1.bat,...)
Putting child 00490378 (CMakeFiles/cmTryCompileExec306416588.dir/testCCompiler.c.obj) PID 4730176 on  the chain.
Live child 00490378 (CMakeFiles/cmTryCompileExec306416588.dir/testCCompiler.c.obj) PID 4730176
Main thread handle = 00000074
The system cannot find the path specified.
Reaping losing child 00490378 PID 4730176
Cleaning up temp batch file C:\Users\CJ\AppData\Local\Temp\make8664-1.bat
mingw32-make.exe: ***  [CMakeFiles/cmTryCompileExec306416588.dir/testCCompiler.c.obj] Error 1

I don't really know too much about the inner workings of make but from what I can tell from this output it looks like it has something to do with the temporary batch file that make is making. 我真的不太了解make的内部工作原理,但从我从这个输出中可以看出,它看起来与正在制作的临时批处理文件有关。 I looked at this stackoverflow post What causes GNU Make to shell out and it looks like what triggers a temporary file to be made is pretty vague. 我查看了这个stackoverflow帖子是什么原因导致GNU Make shell出来 ,看起来触发临时文件的内容非常模糊。 I was able to find a command that executed without the creation of a temporary batch file ("ls" from the windows Git bin) and sure enough it executed via make without returning the "The system cannot find the path specified" response like the "dir" command did ("dir" caused make to generate that temp file). 我能够找到一个在没有创建临时批处理文件的情况下执行的命令(来自Windows Git bin的“ls”)并且确定它通过make执行而没有返回“系统找不到指定的路径”响应,如“ dir“command did(”dir“导致make生成该临时文件)。

I feel like I've kind of hit a wall with my debugging abilities and am turning to you guys to see if you can offer any advice. 我觉得我的调试能力已经碰壁了,我转向你们,看看你们是否可以提供任何建议。 Does it seem like I'm making the right assumptions? 看起来我做出了正确的假设吗? Do you have any insights into what may be manifesting the problem? 您对可能出现的问题有什么见解吗?

It looks like I was able to figure out the problem on my own so sorry for bothering with the post. 看起来我能够自己解决问题所以很抱歉打扰了帖子。 It turns out that the problem wasn't with Make but instead with cmd itself (which would explain the error whenever make tried to run a batch file). 事实证明问题不是使用Make而是使用cmd本身(这可以解释每当make尝试运行批处理文件时的错误)。 It looks like somehow (possibly through some kind of malware that snuck onto my system or maybe some kind of misguided windows update) the Command Processor's registry key was set to something like "C:\\Users\\CJ\\AppData\\Roaming\\Microsoft\\Windows\\IEUpdate\\RMActivate_ssp.exe" which I recall specifically wiping from my computer not too long ago, hence the "The system cannot find the path specified." 它看起来像某种程度(可能通过某种恶意软件偷偷进入我的系统或可能是某种误导的Windows更新)命令处理器的注册表项设置为“C:\\ Users \\ CJ \\ AppData \\ Roaming \\ Microsoft \\ Windows” \\ IEUpdate \\ RMActivate_ssp.exe“我记得特别是不久前从我的电脑上擦过,因此”系统无法找到指定的路径。“ message whenever a cmd process was spawned by make (I guess I just totally missed it when I opened up the root cmd process). 每当cmd进程由make生成时都会显示消息(我想我打开root cmd进程时完全错过了它)。 In any case, this was a simple fix following the instructions at https://superuser.com/questions/727316/error-in-command-line-the-system-cannot-find-the-path-specified , after which I was able to run the make, and subsequently cmake, build without any problems. 无论如何,这是一个简单的修复,遵循https://superuser.com/questions/727316/error-in-command-line-the-system-cannot-find-the-path-specified中的说明,之后我能够运行make,然后cmake,构建没有任何问题。

The keys in question are HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Command Processor\\AutoRun and/or HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor\\AutoRun 有问题的密钥是HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Command Processor\\AutoRun和/或HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor\\AutoRun

Also this error can occur if you picked MSYS toolset in Cmake, but running it under a normal shell. 如果您在Cmake中选择了MSYS工具集,但在普通shell下运行它,也会发生此错误。 In this case make tries to compile something like /c/source/build/stuff.cpp and normal Windows ABI rejects this path. 在这种情况下, make尝试编译像/c/source/build/stuff.cpp这样的/c/source/build/stuff.cpp而正常的Windows ABI拒绝这个路径。

A great diagnostic method for this issue is --debug-trycompile flag for Cmake. 这个问题的一个很好的诊断方法是--debug-trycompile标志。 If something has gone bad, you can re-run the failed command manually or peek into generated files to find the cause. 如果出现问题,您可以手动重新运行失败的命令,或查看生成的文件以查找原因。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows CMD.exe “系统找不到指定的路径。” - Windows CMD.exe "The system cannot find the path specified." 报错:系统找不到指定的路径 - Make error: The system cannot find the path specified “该系统找不到指定的路径。” 尝试使用 asadmin 启动 GlassFish 时出现错误消息 - "The system cannot find the path specified." error message when trying to start GlassFish with asadmin 每当我尝试通过cmd运行php时,“系统找不到指定的路径。” - “The system cannot find the path specified.” whenever i try to run php via cmd Terraform 抛出错误:错误配置 Terraform AWS Provider:系统找不到指定的路径 - Terraform throwing error:error configuring Terraform AWS Provider: The system cannot find the path specified R 在 Windows10 上启动-“系统找不到指定的路径。” 信息。 我怎样才能找到路径? - R Startup on Windows10- “The system cannot find the path specified.” message. How can I find the path? Python:[错误3]系统找不到指定的路径: - Python :[Error 3] The system cannot find the path specified: npm.cmd 在每个命令上都说“系统找不到指定的文件。(操作系统错误2)” - npm.cmd says "The system cannot find the file specified. (os error 2)" on every command 如何修复“--go_out:protoc-gen-go:系统找不到指定的文件”。 错误 - How to fix ‘--go_out: protoc-gen-go: The system cannot find the file specified.’ error 批处理文件中出现意外的“系统无法找到指定的驱动器。” - Unexpected “The system cannot find the drive specified.” in batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM