When a recipe in my makefile fails to compile because of a code error I am provided with an unhelpful message from make.
>make debuglog.o
make: ***. Stop.
When I manually invoke the commands which make would use, I am provided with a useful error message.
>gcc -std=c11 -Iinclude -c debuglog.c
debuglog.c: In function 'writeToLog':
debuglog.c:22:29: error: expected expression before '=' token
...
This doesn't happen with other recipes in the same makefile however sometimes after changing the code, make
errors with make: Interrupt/Exception caught (code = 0xc0000005 ...)
, but rerunning the recipe works fine and everything compiles/links. I'm not sure if the problems are related.
I may have written my recipe incorrectly:
debuglog.o : include/debuglog.h include/config.h debuglog.c
$(CC) -std=c11 -Iinclude -c debuglog.c
I would expect any error messages generated by GCC to be displayed before make fails/terminates, but they aren't shown.
Platform: Microsoft Windows 7 SP1 [Version 6.1.7601]
>make -v
GNU Make 4.0
Built for x86_64-w64-mingw32
>gcc --version
gcc (GCC) 4.8.3
Edit: I changed my toolchain and I now always get useful error messages (with color), however the Interrupt/Exception error now occurs every time I change main.c
. All .o
files are created, so I think the error must be occurring when linking. I can run make
multiple times without error as long as re-compiling isn't required.
Perhaps I need to now update make
, to prevent some sort of concurrency/file access issue...?
>gcc --version
gcc (Rev2, Built by MSYS2 project) 9.2.0
>ld -v
GNU ld (GNU Binutils) 2.32
Edit 2: If I edit my makefile
recipe thusly
app : debuglog.o minIni.o main.o
C:\MinGW\msys\1.0\bin\sleep.exe 1
$(LINK) -o app minIni.o debuglog.o main.o -Llib -lkernel32 -lole32 -Bstatic -lmingw32 -lgcc -Bdynamic -lglew32.dll -lSDL2main -lSDL2 -lOpenGL32 -lfreetype -lavformat -lavdevice -lavcodec -lx264 -lavutil
I can call make
multiple times and the error doesn't resolve itself!
>make
C:\MinGW\msys\1.0\bin\sleep.exe 1
make: Interrupt/Exception caught (code = 0xc0000005, addr = 0x000007FEFF7C2020)
>make
C:\MinGW\msys\1.0\bin\sleep.exe 1
make: Interrupt/Exception caught (code = 0xc0000005, addr = 0x000007FEFF7C2020)
>make
C:\MinGW\msys\1.0\bin\sleep.exe 1
make: Interrupt/Exception caught (code = 0xc0000005, addr = 0x000007FEFF7C2020)
...
But as soon as I remove the sleep line,
>make
gcc -o app minIni.o debuglog.o main.o -Llib -lkernel32 -lole32 -Bstatic -lmingw32 -lgcc -Bdynamic -lglew32.dll -lSDL2main -lSDL2 -lOpenGL32 -lfreetype -lavformat -lavdevice -lavcodec -lx264 -lavutil
>
it works OK!?
User contributions licensed under CC BY-SA 3.0