New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"zig cc a.c" produces no output file, which breaks autoconf (probably an LLVM 15.0.0 regression) #12858
Labels
bug
Observed behavior contradicts documented or intended behavior
regression
It worked in a previous version of Zig, but stopped working.
zig cc
Zig as a drop-in C compiler feature
Milestone
Comments
williamstein
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Sep 15, 2022
This was caused by fda6d44 ; rolling it back brings our precious |
motiejus
referenced
this issue
Sep 19, 2022
This commit makes `zig cc` match the equivalent behavior of `zig build-exe` with regards to caching. That is - it will cache individual .c to .o compilations (with the usual exceptions), but will always repeat the linking process so that incremental linking has a chance to happen. Perhaps a future enhancement will provide a way to get the old behavior, but I suspect this new behavior will be preferred by everyone, because it is closer to what C compilers do. Note that the old behavior can be obtained by switching to `zig build-exe` instead of `zig cc` and using the `--enable-cache` parameter. Closes #12317
motiejus
added a commit
to motiejus/zig
that referenced
this issue
Sep 19, 2022
If `-o` is not specified for `zig cc` for linking, it should emit the `a.out` (or equivalent) to the current directory. So then this: $ zig cc test.c Should result in `./a.out`. If directory is omitted from `Compilation.EmitLoc`, it will default to the cache directory later in the compilation chain, which will result in `a.out` missing in the current directory. If we specify the directory to `Compilation.EmitLoc`, it will be handled, allegedly, correctly. Fixes ziglang#12858
andrewrk
added
the
regression
It worked in a previous version of Zig, but stopped working.
label
Sep 19, 2022
andrewrk
pushed a commit
that referenced
this issue
Sep 19, 2022
If `-o` is not specified for `zig cc` for linking, it should emit the `a.out` (or equivalent) to the current directory. So then this: $ zig cc test.c Should result in `./a.out`. If directory is omitted from `Compilation.EmitLoc`, it will default to the cache directory later in the compilation chain, which will result in `a.out` missing in the current directory. If we specify the directory to `Compilation.EmitLoc`, it will be handled, allegedly, correctly. Fixes #12858
FabianHahn
pushed a commit
to FabianHahn/bazel-zig-cc
that referenced
this issue
Sep 28, 2022
This reverts commit f161caf. This version has a bug that's been fixed upstream, but a new nightly did not come out yet: ziglang/zig#12858
Vexu
pushed a commit
to Vexu/zig
that referenced
this issue
Oct 10, 2022
If `-o` is not specified for `zig cc` for linking, it should emit the `a.out` (or equivalent) to the current directory. So then this: $ zig cc test.c Should result in `./a.out`. If directory is omitted from `Compilation.EmitLoc`, it will default to the cache directory later in the compilation chain, which will result in `a.out` missing in the current directory. If we specify the directory to `Compilation.EmitLoc`, it will be handled, allegedly, correctly. Fixes ziglang#12858
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Observed behavior contradicts documented or intended behavior
regression
It worked in a previous version of Zig, but stopped working.
zig cc
Zig as a drop-in C compiler feature
Zig Version
0.10.0-dev.4060+61aaef0b0
Steps to Reproduce
int main() { return 0; }
zig cc a.c
Expected Behavior
The file
a.out
should be created.Actual Behavior
No output file at all is created.
I noticed this when trying to use autoconf to build a simple C program (lzma in this case), but it would immediately break pretty much all use of autoconf, whose most basic test is to build a trivial
conftest.c
and check for one of the following output files (copied from autoconf source code);Anyway, this is a really serious bug. I've rarely hit a bug I couldn't work around, but this would be painful, and require writing wrapper scripts to replace
zig cc a.c
withzig cc a.c -o a.out
, etc. That is a bit too much to get right.The text was updated successfully, but these errors were encountered: