gmake; mktemp.exe has stopped working

I'm not sure if this is an issue with Premake or not. I was trying to use premake (through MSys) for GNU on the Unofficial OpenGL SDK. Running premake will proceed up to a point where a warning pops up saying that mktemp has stopped working. After choosing to close the program, the Premake utility will continue and makefiles will be generated, but running make on these yields an error.

I can't seem to find anything related on Google other than this:

https://github.com/shoes/shoes/issues/97

Running premake for CodeBlocks or Xcode3 on the same archive doesn't seem to yield any problems. I only get this error when trying to use the 'gmake' setting on Premake.

So I'm trying to determine whether this is a 64 bit W7 issue, a Premake issue or an Unofficial OpenGL SDK issue. Obviously, I'm a noob with this stuff, so any thoughts/ suggestions would be greatly appreciated.

Could you post output of Premake and exact error message from make?

This is the output for premake when using the 'gmake' parameter. The mktemp.exe error comes up when 'creating ./config.status'. I include the output for make after this:

checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking for an ANSI C-conforming const... yes
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by gcc... c:/mingw/mingw32/bin/ld.exe
checking if the linker (c:/mingw/mingw32/bin/ld.exe) is GNU ld... yes
checking for c:/mingw/mingw32/bin/ld.exe option to reload object files... -r
checking for BSD-compatible nm... /c/MinGW/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... no
checking dlfcn.h presence... no
checking for dlfcn.h... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for xlf95... no
checking for f95... no
checking for fort... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 8192
checking command to parse /c/MinGW/bin/nm output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -DDLL_EXPORT
checking if gcc PIC flag -DDLL_EXPORT works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (c:/mingw/mingw32/bin/ld.exe) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... c:/mingw/mingw32/bin/ld.exe
checking if the linker (c:/mingw/mingw32/bin/ld.exe) is GNU ld... yes
checking whether the g++ linker (c:/mingw/mingw32/bin/ld.exe) supports shared libraries... yes
checking for g++ option to produce PIC... -DDLL_EXPORT
checking if g++ PIC flag -DDLL_EXPORT works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (c:/mingw/mingw32/bin/ld.exe) supports shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
(cached) (cached) checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for X... no
checking for ANSI C header files... (cached) yes
checking GL/gl.h usability... yes
checking GL/gl.h presence... yes
checking for GL/gl.h... yes
checking GL/glu.h usability... yes
checking GL/glu.h presence... yes
checking for GL/glu.h... yes
checking GL/glx.h usability... no
checking GL/glx.h presence... no
checking for GL/glx.h... no
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking sys/ioctl.h usability... no
checking sys/ioctl.h presence... no
checking for sys/ioctl.h... no
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking whether time.h and sys/time.h may both be included... yes
checking for X11/extensions/xf86vmode.h... no
checking X11/extensions/XI.h usability... no
checking X11/extensions/XI.h presence... no
checking for X11/extensions/XI.h... no
checking X11/extensions/XInput.h usability... no
checking X11/extensions/XInput.h presence... no
checking for X11/extensions/XInput.h... no
checking whether gcc needs -traditional... no
checking for vprintf... yes
checking for _doprnt... no
checking for cos in -lm... yes
checking for gettimeofday... yes
./configure: line 22660: sort: No such file or directory
./configure: line 22657: sed: No such file or directory
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating include/GL/Makefile
config.status: creating include/Makefile
config.status: creating progs/Makefile
config.status: creating progs/demos/CallbackMaker/Makefile
config.status: creating progs/demos/Fractals/Makefile
config.status: creating progs/demos/Fractals_random/Makefile
config.status: creating progs/demos/Lorenz/Makefile
config.status: creating progs/demos/Makefile
config.status: creating progs/demos/One/Makefile
config.status: creating progs/demos/shapes/Makefile
config.status: creating progs/demos/smooth_opengl3/Makefile
config.status: creating progs/demos/spaceball/Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
./configure: line 24072: sort: No such file or directory
./configure: line 24069: sed: No such file or directory
Building configurations...
Running action 'gmake'...
Generating Makefile...
Generating glload/Makefile...
Generating glimg/Makefile...
Generating glfw/Makefile...
Generating freeglut/Makefile...
Done.

And the output for make on the same directory:

==== Building glload (debug) ====
Creating lib
Creating Debug
gll_c.c
/bin/sh: /c/cygwin/bin/cc: Bad file number
make[1]: *** [Debug/gll_c.o] Error 126
make: *** [glload] Error 2

I guess your Cygwin installation is broken. It seems like you don't have working sed, sort, and cc.

UPDATE: Must have been writing this when you responded.

Made some progress, but still get make error. Unfortunately I went about this in a way that was not methodical, but I can narrow down part of the problem to 4 Cygwin packages. I downloaded and installed the binutils packages for Cygwin, 3 of which were specifically for use with MinGW. My reasoning was that maybe the mktemp.exe file was corrupt, which is included in the binutils package for Cygwin. So now after using premake, I no longer get the 'mktemp.exe' has stopped working error.

I'm guessing that the problem is in the glload directory or makefile, since I still get the same make error for glload (printed at the end of my previous post). I have now run make in the glutil and glmesh subdirectories and it appears that they were built properly (no error output and .a files created).

Output from running make in the glload directory:

gll_c.c
/bin/sh: /c/cygwin/bin/cc: Bad file number
make[1]: *** [Debug/gll_c.o] Error 126

>I downloaded and installed the binutils packages for Cygwin, 3 of which were specifically for use with MinGW.

You cannot use MinGW within Cygwin. It's a native Windows toolchain.

I ran make from the Cygwin Terminal and it seemed to work fine. So my problem was that I was using the MinGW Shell to run make? BTW, expressing gratitude here so as not to waste another comment: Thanks!

Sorry, I couldn't understand if you've solved your problems or not. However, you should consider the next things:

1) Don't mix up Cygwin and MinGW - they are 2 different worlds. MinGW is port of GCC + minimal GNU evironment that runs on Windows and targets Windows. Cygwin is a complete Unix-like environment on top of Windows, and its compiler targets the same environemnt (i.e., resulting binary is not easily redistributable)

2) /c/cygwin/bin/cc is not a traditional Windows path. Such paths will work only with POSIX-compliant shell (e.g. bash) and won't work with cmd.exe. Look what shell are you starting in each case.

3) Those "shell" items in Windows menu can start not only different shells, but also the same shell but with different environment variables. It's also important.

The problem is solved. Thanks for the info and help!

Thanks for getting that sorted, annulen.