MinGW使抛出“系统找不到指定的路径".错误 [英] MinGW Make throwing "The system cannot find the path specified." error

查看:637
本文介绍了MinGW使抛出“系统找不到指定的路径".错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows 7上使用cmake生成一个c ++项目.尽管看上去确实如此,但在cmake制作该项目之前,它会对您的工具链进行了快速测试(我正在使用MinGW),这就是我的问题所在. Cmake触发了一个make构建,该构建最终因响应系统找不到指定的路径"而失败.

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. Cmake triggers a make build which ultimately fails with the response "The system cannot find the path specified."

我运行了在空运行模式(-n)下失败的特定makefile,并手动执行了所有命令:

I ran the particular makefile that was failing in dry run mode (-n) and manually executed all the commands:

"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时,我返回错误:

And they all executed without error leaving me with a functional .exe file as expected. However when run through make I return the error:

"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运行时返回系统无法找到指定的路径",然后打印出dir信息并退出并出现错误.

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.

下一步,大约是,我要使用-d标志运行make.有趣的是:

My next step, and about as far as I've gotten, is to run make with the -d flag; 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

我真的不太了解make的内部工作原理,但是从我的输出可以看出,它似乎与make的临时批处理文件有关.我查看了这个stackoverflow帖子是什么原因导致GNU Make被淘汰,看起来触发临时文件的原因非常模糊.我能够找到一个无需创建临时批处理文件即可执行的命令(从Windows Git bin中创建"ls"),并确保通过make足以执行该命令,而不会返回系统找不到指定的路径"响应,例如"dir"命令执行了操作("dir"使make生成了该临时文件).

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. 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. 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).

我觉得我的调试能力使我有点不知所措,并且正在向你们求助,看看您是否可以提供任何建议.看来我在做正确的假设吗?您对可能出现问题的原因有什么见识?

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?

推荐答案

看来我能够自己解决问题,所以很抱歉打扰该帖子.事实证明,问题不是出在Make上,而是在cmd本身上(当make尝试运行批处理文件时,它将解释该错误).看起来(以某种方式(可能是通过某种类型的恶意软件潜入了我的系统或某种错误的Windows更新)),命令处理器的注册表项被设置为"C:\ Users \ CJ \ AppData \ Roaming \ Microsoft \ Windows" \ IEUpdate \ RMActivate_ssp.exe",我记得不久前专门从我的计算机上擦除过,因此系统找不到指定的路径". make生成cmd进程时将显示一条消息(我猜想我在打开根cmd进程时完全错过了它).无论如何,这都是按照

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). 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." message whenever a cmd process was spawned by make (I guess I just totally missed it when I opened up the root cmd process). 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.

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

The keys in question are HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun and/or HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

这篇关于MinGW使抛出“系统找不到指定的路径".错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆