繁体   English   中英

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

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

我正在尝试在Windows 7上使用cmake生成一个c ++项目。在实际制作项目之前,看起来cmake会快速测试你的工具链(我正在使用MinGW),这就是我的问题所在。 Cmake触发make build,最终因响应“系统无法找到指定的路径”而失败。

我运行了在干运行模式下失败的特定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

他们都没有错误地执行,留下了一个功能正常的.exe文件。 但是当运行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

然后我尝试用简单的“dir”替换所有命令,并注意到在运行make时返回“系统canort再次找到指定的路径”,然后打印出dir信息并退出并显示错误。

我的下一步,就我所知,是使用-d标志运行make; 有趣的是:

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

我真的不太了解make的内部工作原理,但从我从这个输出中可以看出,它看起来与正在制作的临时批处理文件有关。 我查看了这个stackoverflow帖子是什么原因导致GNU Make shell出来 ,看起来触发临时文件的内容非常模糊。 我能够找到一个在没有创建临时批处理文件的情况下执行的命令(来自Windows Git bin的“ls”)并且确定它通过make执行而没有返回“系统找不到指定的路径”响应,如“ dir“command did(”dir“导致make生成该临时文件)。

我觉得我的调试能力已经碰壁了,我转向你们,看看你们是否可以提供任何建议。 看起来我做出了正确的假设吗? 您对可能出现的问题有什么见解吗?

看起来我能够自己解决问题所以很抱歉打扰了帖子。 事实证明问题不是使用Make而是使用cmd本身(这可以解释每当make尝试运行批处理文件时的错误)。 它看起来像某种程度(可能通过某种恶意软件偷偷进入我的系统或可能是某种误导的Windows更新)命令处理器的注册表项设置为“C:\\ Users \\ CJ \\ AppData \\ Roaming \\ Microsoft \\ Windows” \\ IEUpdate \\ RMActivate_ssp.exe“我记得特别是不久前从我的电脑上擦过,因此”系统无法找到指定的路径。“ 每当cmd进程由make生成时都会显示消息(我想我打开root cmd进程时完全错过了它)。 无论如何,这是一个简单的修复,遵循https://superuser.com/questions/727316/error-in-command-line-the-system-cannot-find-the-path-specified中的说明,之后我能够运行make,然后cmake,构建没有任何问题。

有问题的密钥是HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Command Processor\\AutoRun和/或HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor\\AutoRun

如果您在Cmake中选择了MSYS工具集,但在普通shell下运行它,也会发生此错误。 在这种情况下, make尝试编译像/c/source/build/stuff.cpp这样的/c/source/build/stuff.cpp而正常的Windows ABI拒绝这个路径。

这个问题的一个很好的诊断方法是--debug-trycompile标志。 如果出现问题,您可以手动重新运行失败的命令,或查看生成的文件以查找原因。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM