Skip to content

Intermittent error: unable to build compiler_rt: FileNotFound from zig cc #13515

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

Closed
plajjan opened this issue Nov 11, 2022 · 2 comments
Closed
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@plajjan
Copy link

plajjan commented Nov 11, 2022

Zig Version

v0.10.0

Steps to Reproduce and Observed Behavior

I'm occasionally seeing errors from zig cc, either one of:

  • error: unable to build compiler_rt: FileNotFound
  • error: FileNotFound

Not sure if both errors are just symptoms of the same problem or separate, ultimately it's about some file not being found. Keeping it together in this one issue for now.

  • zig is used as part of Acton, a programming language
  • actonc, the Acton compiler, generates C code as output and then invokes zig cc to compile that
    • the generated .h and .c files are written to a random temporary directory, like /tmp/acton-23ha3sASc4Mf
  • failures mostly happen in CI while running test suite
    • test suite consists of ~100 small acton programs, so actonc is run on each and invokes zig cc at least twice for each program (compiles acton module separately and then builds final executable)
    • tests are compiled and run concurrently, so zig cc is potentially running concurrently

It's not entirely simple to reproduce since it isn't happening consistently but rather sporadically. I have started collecting observed occurrences in actonlang/acton#1095

Best bet to reproduce locally is to run the test suite in https://github.com/actonlang/acton/ repeatedly:

  • install build dependencies: apt install gcc haskell-stack libprotobuf-c-dev make pkg-config procps zlib1g-dev
  • git clone https://github.com/actonlang/acton.git
  • build acton: cd acton && make -j
  • now repeatedly run test suite using: make test until it fails

I found #9431 while searching, but it's closed and well, the problem is certainly present in v0.10.0.

  • What can I do to better understand this problem?
    • It would IMHO be helpful if zig included the actual file it says it cannot find?
    • The only thing I could come up with is to add --verbose to the zig cc invocation, which I'm about to do...
  • Is it likely that this is a concurrency bug of some form? Does zig place temporary files somewhere which could conflict?

Expected Behavior

Program to compile successfully!

@plajjan plajjan added the bug Observed behavior contradicts documented or intended behavior label Nov 11, 2022
@andrewrk andrewrk added this to the 0.11.0 milestone Jan 23, 2023
@motiejus
Copy link
Contributor

Most likely fixed in fae6290

plajjan added a commit to actonlang/acton that referenced this issue Jun 22, 2023
This includes a commit that likely fixed the problems we've seen with
spurious "File not found" errors from zig, see
ziglang/zig#13515. Although, since switching
to using zig more natively with build.zig, I don't think I've seen those
errors. Doesn't hurt upgrading though.
@plajjan
Copy link
Author

plajjan commented Jun 22, 2023

Cool! I agree that the linked commit sounds like a very plausible explanation and since that is now fixed, so is likely this issue.

I've switched to latest nightlies in the Acton project, where I encountered these issues.

I should say that I have recently also done changes to how zig is called from within Acton and I believe that since those changes the "File not found" issues have not appeared, but it's not entirely conclusive as it wasn't that frequently occurring in the first place. A little hard to tell.

I think the easiest thing going forward is to close this issue. If I see the problem again, I can reopen this issue or open a new one.

@plajjan plajjan closed this as completed Jun 22, 2023
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
Projects
None yet
Development

No branches or pull requests

3 participants