makefilemingw-w64

mingw32-make application was unable to start correctly (0xC0000142)


I installed mingw64 on my Windows 11 system a few days ago.

When using mingw32-make, the following code (lines 27 and 28) in the makefile is failing.

voice.exe: ${OBJS}
    ${CC} -o "$@" ${OBJS} ${LDFLAGS}

If I run mingw32-make from Sublime text, I get a message "application was unable to start correctly (0xC0000142)".

Running mingw32-make directly from powershell gives the following output:

PS C:\proj\simulate> mingw32-make
gcc -o "voice.exe" obj/main.o obj/arpeggio.o obj/chord.o obj/frame.o obj/measure.o obj/note.o obj/polyphonic.o obj/sample.o obj/source.o obj/synth.o  -s
mingw32-make: *** [Makefile:28: voice.exe] Error -1073741502
PS C:\proj\simulate> 

If I run the generated command directly from powershell, it works. This is the command:

gcc -o "voice.exe" obj/main.o obj/arpeggio.o obj/chord.o obj/frame.o obj/measure.o obj/note.o obj/polyphonic.o obj/sample.o obj/source.o obj/synth.o  -s

Is there any way to fix this problem so that I can complete the build using mingw32-make?


Solution

  • I identified the problem by using the -d option on mingw32-make.

    The debug information showed that mingw32-make was using sh.exe to create a new process for gcc, and sh.exe isn't included with mingw-64. You have to install msys2 to get the unix-style commands, which include sh.exe.

    After installing msys2 and adding c:\msys64\user\bin to the path, mingw32-make started working.

    According to this post, https://superuser.com/questions/1258498/how-to-start-the-shell-in-mingw-64 it is stated in the documentation that these commands are not included... but I am not very diligent about reading documentation :-(