Nim "execution of an external program failed: gcc" in CI
Nim compiles to C and then invokes a C compiler to produce the binary. This error means that gcc step failed, either because gcc is absent on the runner or because compiling or linking the generated C errored.
What this error means
After Nim finishes its own pass, the build fails with "Error: execution of an external program failed: 'gcc ...'". The real gcc output appears just above the line.
Error: execution of an external program failed: 'gcc -c -w ... @m..@smain.nim.c.o ...'Common causes
No C compiler on the runner
A slim image without build-essential has no gcc, so Nim cannot run the backend compile step.
The generated C failed to compile or link
A missing system header, a missing C library, or a link error in the generated C makes gcc exit non-zero; Nim reports it as an external program failure.
How to fix it
Install a C toolchain on the runner
Provide gcc and the standard headers before the Nim build.
sudo apt-get update && sudo apt-get install -y build-essentialRead the captured gcc output
- Scroll up to the gcc error printed above the Nim line.
- Install the missing dev header or library it names (for example "cannot find -lpcre" needs libpcre3-dev).
- Re-run; the Nim line clears once gcc succeeds.
How to prevent it
- Install build-essential before Nim builds on slim images.
- Add required
-devsystem packages for C-linking dependencies. - Read the gcc output above the Nim summary to find the real cause.