gcc fails with spawn: No such file or directory

后端 未结 7 2236
醉梦人生
醉梦人生 2021-02-13 13:41

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         


        
7条回答
  •  遇见更好的自我
    2021-02-13 14:06

    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.

提交回复
热议问题