Open konsolas opened 2 years ago
I'm not sure what kind of shell you are using that uses >
as pipe symbol.
In fish:
> echo 'int main() {}' | zig cc -xc /dev/stdin -o out
ld.lld: error: undefined symbol: main
It seems like zig cc
does read from /dev/stdin, but cannot understand it.
The following works:
> echo 'int main() {}' > a.c
> zig cc a.c
The >
was a typo, but the results are the same. Also note that /dev/stdin isn't available on e.g. Windows.
You can create a temp file and work around this. This is a weird use case.
Zig Version
0.9.0
Steps to Reproduce
Running this command to compile a program from stdin
Expected Behavior
The same command succeeds with clang.
produces an executable
a.out
that does nothing.Actual Behavior
zig cc
gives the following output and nothing else:This means that
zig cc
is not a drop-in solution for projects that dynamically generate c/c++ source code during the build process which is directly piped to the compiler.This issue was fixed previously but in a different context: https://github.com/ziglang/zig/issues/6271