gcc失败并生成:没有这样的文件或目录 [英] gcc fails with spawn: No such file or directory
问题描述
我下载了
Ruben的
构建版本 Cygwin GCC 。
但是在运行时似乎无法编译任何文件
$ touch foo.c
$ gcc foo.c
gcc:错误:生成:没有这样的文件或目录
作为解决方法,我发现了工作
i686-w64-mingw32-gcc foo.c
$
结果是,在/ usr / bin和/ bin中有gcc的副本(至少在我的安装目录中)。
执行/ bin / gcc失败,并出现上述错误-我猜是由于相对路径的假设不正确?
执行/ usr / bin / gcc可以正常工作!
在我的情况下,问题是我无意中将 / bin注入到我的PATH环境变量中,导致执行了/ bin / gcc而不是/ usr / bin / gcc。
仍然不清楚为什么在不同的地方有两个gcc二进制文件(看起来是相同的)...也许Cygwin专家可以回答这个问题;也许我的安装被foo-barred禁止。
I downloaded Ruben’s build of Cygwin GCC.
However upon running it seems unable to compile any files
$ touch foo.c $ gcc foo.c gcc: error: spawn: No such file or directoryAs a workaround, I found this to work
i686-w64-mingw32-gcc foo.c
解决方案I had this same problem on Cygwin64, and the solution was PATH related..kinda.
Turns out, there are copies of gcc in /usr/bin and /bin (at least, there is in my install).
Executing /bin/gcc failed with the error above -- I'm guessing due to incorrectly assumed relative paths???
Executing /usr/bin/gcc works as expected!
In my case, the "problem" was that I had inadvertently injected "/bin" into my PATH environment variable, resulting in /bin/gcc being executed, instead of /usr/bin/gcc. Removing the "/bin" from the path solved the problem.
Still unclear why there are two gcc binaries (which appear to be identical) in different places... but maybe the Cygwin gurus can answer that; or maybe my installation is just foo-barred.
这篇关于gcc失败并生成:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!