Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc fails with spawn: No such file or directory

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 directory

As a workaround, I found this to work

i686-w64-mingw32-gcc foo.c
like image 556
Zombo Avatar asked May 18 '13 06:05

Zombo


2 Answers

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.

like image 186
bloatedfish Avatar answered Sep 21 '22 00:09

bloatedfish


I had the same problem and solved it by installing the g++ package in addition to gcc-core

like image 32
Felix Burkhardt Avatar answered Sep 19 '22 00:09

Felix Burkhardt