-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Compiler fails without explanation or trace #6909
Comments
If you ever see this, there is one clear action path to take, which is to get a debug build of the compiler and cause the issue again, because it means we need to add another NTSTATUS code to the switch case, and a debug build will tell you the source line and the NTSTATUS number. Right now it is annoying to get a debug build of zig on windows if you are building with MSVC because MSVC does not let you mix release LLVM + debug zig. However I have a plan to use zig-bootstrap to distribute a "zig source toolkit" which is a .zip file which contains release LLVM+LLD+Clang+Zig and then you can use zig as a C/C++ compiler for building zig from source, in any mode. This will make it easy to work on zig without even having MSVC installed. |
I do a lot of Windows development and I probably stress the pipeline in slightly unusual ways as I build freestanding kernels in that environment so I'm happy to take this further with a debug build as soon as possible. Let me know what I can do to help. I've also seen problems with the build pipeline (build.zig) on Windows which appear to be related to the use of NtCreateFile but I've not had an opportunity to try and diagnose it further. |
@andrewrk it sounds like in a release build, we don't really have a feasible way to solve this? If so, maybe the solution here is to have Zig handle unexpected errors with a message like this? > zig build-obj src\..\src\bug.zig
An unexpected error occurred, unable to gather more information since this is a release build of the compiler. At least with this people who run into unexpected errors will have an idea of what action to take next (i.e. try to get a debug build of the compiler to root cause the underlying issue). |
@marler8997 that looks reasonable. It would be pretty straightforward to translate errors that end up bubbling out of main into more friendly errors explaining what steps could be taken next. |
There is a bug that's a few months old now where the Zig compiler will fail if any pathnames contain
".."
on Windows (see #6044).However, there are really 2 problems here, the first being that the Zig compiler can't handle
..
in pathnames, and the second being that the compiler fails without a helpful explanation as to what happened. I've created this issue to track and second problem. I'm not sure if the lack of an error message or error trace is unique to this".."
problem, or if there are other codepaths in the compiler that would also cause this.The following will reproduce this issue on Windows:
A better experience would look something like this:
Printing an error trace would also be better.
Issue also seen on Reddit: https://www.reddit.com/r/Zig/comments/jlprjh/trying_to_diagnose_compiler_error_unexpected/
The text was updated successfully, but these errors were encountered: