Yet Another MinGW "gcc: error: CreateProcess: No such file or directory"
Asked Answered
A

9

15

I have installed MinGW C compiler in Windows 8 (64 bit) through the GUI installer. But when I try to compile a C program, gcc says: gcc: CreateProcess: No such file or directory

It is a common bug, and I have tried all the solutions I found, without success.

In particular, (following CreateProcess: No such file or directory) I have tried to:

  1. [EDITED] Add C:\MinGw\libexec\gcc\mingw32\4.7.2 to my system PATH
  2. Uninstall and re-install gcc through mingw-get CLI:

    mingw-get remove mingw32-gcc
    mingw-get install mingw32-gcc

Other suggestions?

EDIT: verbose gcc output:

> gcc -v helloWorld.c
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.2/lto-
wrapper.exe
Target: mingw32
Configured with: ../gcc-4.7.2/configure --enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug --disable-build-poststage1-
with-cxx --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.7.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=i386' '-march=i386'
cc1plus -quiet -v -iprefix c:\mingw\bin\../lib/gcc/mingw32/4.7.2/
OPTIONS.C -quiet -dumpbase OPTIONS.C -mtune=i386 -march=i386 -auxbase OPTIONS -
version -o C:\Users\elvis\AppData\Local\Temp\cc4fWSvg.s
gcc: error: CreateProcess: No such file or directory
Admittedly answered 10/11, 2012 at 12:17 Comment(15)
Is C:\MinGw\libexec\gcc\mingw32\"MinGW-Version" the actual text you used or did you use the version of the compiler. ALso where is gcc.exe on your hard diskSextuple
No, this is only an example, the path I used is the correct one. gcc.exe is in the \bin directory of MinGW installation tree.Admittedly
Unless you can give more information as to what differs this is an exact duplicate of the question you quote.Sextuple
You might like to show us the full command you issued.Latoya
Probably @Latoya meant the full command to compile the program, not to install. Or are you using an IDE?Geniegenii
I indeed did. Sry for being imprecise. Thx! @GeniegeniiLatoya
@Mark I don't know what differs. This is really disappointing beacus this is a know bug, but gcc still doesn't tell me WHAT executable the CreateProcess() function doesn't find.Admittedly
@Geniegenii and alk - Just a simple "gcc helloWorld.c" shows the error.Admittedly
Ok, got the point. It there strace available for you? If yes, try strace gcc helloWorld.c. This might help you to find out what CreateProcess() is missing.Latoya
Search for cc1 or cc1.exe and see if it's in the PATH set when executing gcc.Latoya
cc1.exe is in the \libexec subtree. How to use strace in windows? I see only the UNIX version. Or should I use an alternative such straceNT or similar?Admittedly
Try running gcc -v helloWorld.c and paste the results here. It should tell what it is trying to run.Geniegenii
@ital: your -v output has considerably less information that what I get. For example, yours has no info on COMPILER_PATH. LIBRARY_PATH, or the include search list. I'll drop my output into my question, in case the differences are any help.Ecclesiolatry
Some interesting things I see in your -v output: 1) gcc is building the correct path to lto-wrapper.exe, but not to cc1plus.exe, and 2) why is gcc invoking cc1plus.exe instead of cc1.exe? When I build a simple hello.c program, gcc only invokes cc1.exe; it never invokes cc1plus.exe Do you have other installations of MinGW on your machine?Ecclesiolatry
@MichaelBurr No, It was my first MinGW installation...Admittedly
E
12

You shouldn't add C:\MinGw\libexec\gcc\mingw32\4.7.2 to the path.

Add: c:\MinGW\bin

You may need to reboot to ensure that the path is made available to all processes properly.

Another suggestion is to use a different MinGW distribution. It's been a long time since I used an 'official' MinGW distribution because the installation steps were so byzantine and fragile. I've heard they've made large advances to the installer, but from what I hear it still seems to be rather complicated and fragile.

TDM's installer just works, but I think the TDM release isn't quite to 4.7.2.

The nuwen distribution's installation is just unpacking an archive where you want the thing (I love that!) and making sure the path points to the location of gcc.exe. Nuwen also packages the boost libraries, which is nice.


I case it helps, here's what I get from gcc -v hello.c (c:\mingw.4.7.2\bin is in the path`):

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/lto-wrapper.exe
Target: i686-pc-mingw32
Configured with: ../src/configure --prefix=/c/temp/gcc/dest --with-gmp=/c/temp/gcc/gmp --with-mpfr=/c/temp/gcc/mpfr --with-mpc=/c/temp/gcc/mpc --enable-languages=c,c++ --with-arch=i686 --with-tune=generic --disable-libstdcxx-pch --disable-nls --disable-shared --disable-sjlj-exceptions --disable-win32-registry --enable-checking=release --enable-lto
Thread model: win32
gcc version 4.7.2 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
 c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/cc1.exe -quiet -v -iprefix c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/ hello.c -quiet -dumpbase hello.c -mtune=generic -march=i686 -auxbase hello -version -o C:\Users\mikeb\AppData\Local\Temp\cct1oltc.s
GNU C (GCC) version 4.7.2 (i686-pc-mingw32)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/../../../../i686-pc-mingw32/include"
ignoring duplicate directory "c:/mingw.4.7.2/lib/gcc/../../lib/gcc/i686-pc-mingw32/4.7.2/include"
ignoring nonexistent directory "c:/temp/gcc/dest/include"
ignoring nonexistent directory "/c/temp/gcc/dest/include"
ignoring duplicate directory "c:/mingw.4.7.2/lib/gcc/../../lib/gcc/i686-pc-mingw32/4.7.2/include-fixed"
ignoring nonexistent directory "c:/mingw.4.7.2/lib/gcc/../../lib/gcc/i686-pc-mingw32/4.7.2/../../../../i686-pc-mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/include
 c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/../../../../include
 c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/include-fixed
End of search list.
GNU C (GCC) version 4.7.2 (i686-pc-mingw32)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8461a53e6fc78ff58191bda61fe9586d
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
 as -v -o C:\Users\mikeb\AppData\Local\Temp\ccqRcYAj.o C:\Users\mikeb\AppData\Local\Temp\cct1oltc.s
GNU assembler version 2.22 (i686-pc-mingw32) using BFD version (GNU Binutils) 2.22
COMPILER_PATH=c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/;c:/mingw.4.7.2/bin/../libexec/gcc/
LIBRARY_PATH=c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/;c:/mingw.4.7.2/bin/../lib/gcc/;c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/../../../
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
 c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/collect2.exe -Bdynamic c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/../../../crt2.o c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/crtbegin.o -Lc:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2 -Lc:/mingw.4.7.2/bin/../lib/gcc -Lc:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/../../.. C:\Users\mikeb\AppData\Local\Temp\ccqRcYAj.o -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/crtend.o
Ecclesiolatry answered 10/11, 2012 at 21:36 Comment(5)
I have already set c:\MinGW\bin in my PATH. I'll try the different distributions, thank you for the tip.Admittedly
The nuwen distro works fine, thank you. I can consider solved this problem. BTW I hope that mingw developers will debug it.Admittedly
TDM works perfectly and was trivial to install. Thank you very much for your assistance.Transportation
Actually, in my case, the path you mentioned MUST be in the path, ALONG with the c:\MinGW\bin. Adding the path with the version number solved the CreateProcess problem for meDraggletailed
The nuwen distro solution works seamlessly. It also has a bat file for setting all the env variablesSaleem
K
1

In my case, I had uninstalled a few items in MinGW to save space on my SSD. Installing mingw32-gcc dev class fixed this problem for me.

Kelter answered 22/7, 2014 at 17:14 Comment(0)
R
1

I had the same error. I have 64 bit win 7 OS. First I installed 32 bit MinGW, gcc was installed successfully but showing this error. Tried installing 64 bit MinGW but failed to install. Searched a lot, tried many things but nothing worked.

Finally installed "tdm64-gcc-5.1.0-2" from this link >> https://sourceforge.net/projects/tdm-gcc/?source=typ_redirect

It installed & worked in single attempt without any error. Nothing special tried.

And the basic important point, after installation need to add "bin" directory on env path ('C:\TDM-GCC-64\bin' in my case). Then check gcc installation from this command on console >> "gcc --version" , this will show the gcc version installed.

Relations answered 2/8, 2016 at 12:9 Comment(0)
L
1

I installed MinGW of the ofcial website.
I select "Basic Setup"( I only wanted get c compiler), and I marked all package, after this installation I added the path, in my case.

C:\MinGW\bin.

I created a c file in

C:\Users\christian\Documents\C projects\

with the name untitled1.c

Wen I tried to use the command

gcc untitled.c

the command promt showed me that message.

gcc: CreateProcess: No such file or directory


How did I solve this problem?
I removed all package,

-Open "MinGW Installation Manager"
-Select "Basic Setup".
-Mark for removal all packages.
-Select "Installation" tap.
-Click in Apply changes.
-After you can install those again.


Operating system

  • Edition: Windows 10 Pro
  • Version: 1607
  • Os build: 14393.187
Lorrimor answered 27/9, 2016 at 23:15 Comment(0)
M
1

I have the same problem.

I have a startgcc.bat in my folder.
It's OK for me just after remove double quotation marks in my PATH assignment. my bat script:

@title gcc-mingw
@rem @cd /d %~dp0

@rem below line will fail and got error: gcc.exe: error: createprocess: no such file or directory
@rem @set path="C:\mingw64\bin";%path%

@rem below lines works ok without double quotation marks
@set path=C:\mingw64\bin;%path%
@set path=C:\mingw64\opt\bin\;%path%
@cmd
Moyra answered 23/11, 2017 at 3:16 Comment(0)
I
0

In my case, the installer mingw-get-setup.exe failed to download some files, so the gcc complication tool chain is broken, when rerun mingw-get-setup.exe and get the lost files, it is OK.

Ignaciaignacio answered 22/7, 2014 at 11:52 Comment(0)
G
0

In my case, multiple toolchains had placed different gcc installs into PATH.

(This is turning into a switch!)

Georginegeorglana answered 21/5, 2016 at 14:50 Comment(0)
S
0

In my case, getting rid of the [=n] parameter when specifying -flto solved the problem.

Specifically, instead of using

-flto=6

in CFLAGS, CXXFLAGS and LDFLAGS, I'm now using simply

-flto


Looks like this is a MinGW-w64 bug, thought at this point I'm not sure whether it might be caused by my using of the -j6 parameter when invoking make.

For future reference, my entire command line is as follows:

mingw32-make -f makefile.gcc CFLAGS="-std=c11 -pipe -O3 -flto" CXXFLAGS="-std=c++14 -pipe -O3 -flto" LDFLAGS="-pipe -O3 -flto -static-libgcc -static-libstdc++ -s -Wl,--allow-multiple-definition" BUILD=release RUNTIME_LIBS=static DEBUG_FLAG=0 USE_AUI=0 USE_HTML=0 USE_MEDIA=0 USE_OPENGL=0 USE_PROPGRID=0 USE_QA=0 USE_RIBBON=0 USE_RICHTEXT=0 USE_STC=0 USE_WEBVIEW=0 USE_XRC=0 CFG="-stl-static_runtime-O3-flto" -j6

This is for building wxWidgets' "Minimal Sample". About -Wl,--allow-multiple-definition : It's intended to circumvent yet another toolchain bug. More info here and here.

Shoemake answered 15/8, 2016 at 9:21 Comment(0)
P
0

In my case,

  • I added \MinGW\bin in both sys and user variables.
  • Also added \MinGW\msys\2.0\usr\bin in both sys and user variables.

I restarted my computer after doing this. It worked successfully. I got the msys make (unix portable) plus my compilation is working successfully.

Porush answered 11/10, 2022 at 14:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.