How to use `zig cc` without generating a .pdb file?

I am trying to create a transpiler that 1) reads source code in a syntax invented by myself, 2) generates C code, and then 3) passes the generated C code via stdin to execution of a zig cc ... command.

Unfortunately, that zig cc generates not only an .exe file but also .pdb file (!?). I wonder if the .pdb file can be disabled in any way, for example with a magic CLI flag set in front of the zig cc command, with a magic environment variable, by instead using zig build-exe ... with flags to compile the C code via stdin, or some other way. In sum, I am trying to find a painless way of integrating zig cc as a backend C compiler for my transpiler.

Reproducing this can be done as follows:

> # Write a hello world program into a .c file. For example:
> cat .\hello_world.c
#include <stdio.h>

int main(void) {
    printf("hello, world\n");
}
> # Then, compile it by piping it into a `zig cc` command:
> cat .\hello_world.c | zig cc -x c - -Wall -Wextra -o hello_world.exe

And then, I get the following new files in my current working directory: hello_world.exe; and hello_world.pdb.

What can I do differently so that the .pdb file does not appear?

try

short, long                     desc
-s, -Wl,--strip-all             Strip all symbols
-S, -Wl,--strip-debug           Strip debugging symbol

Hi @nullptrdevs . Thanks for these suggestions. Unfortunately, none works perfectly.

-s generates an .exe without generating a .pdb and the generated .exe runs fine. However, the compilation is noticeably slower than mingw-w64’s C compiler, and some messages (e.g. mingw-w64 msvcrt-os.lib… ) flash up on the terminal and then disappear.

-S generates an .exe without generating a .pdb, but the generated .exe doesn’t run.

-Wl, --strip-all, and --strip-debug are not available CLI options in zig cc.

Welcome @raised_error ,

Linker accepts the option /pdb:/path/to/pdb/file.
zig cc accepts the flag -Xlinker to send a flag to the linker.
Together:

zig cc -target x86_64-windows t.c -Xlinker /pdb:/dev/null -o t.exe

Please note that without pdb you will not have function names and source lines on your crash stack traces.