zig icon indicating copy to clipboard operation
zig copied to clipboard

Intermittent `error: unable to build compiler_rt: FileNotFound` from `zig cc`

Open plajjan opened this issue 3 years ago • 1 comments

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 https://github.com/actonlang/acton/issues/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 avatar Nov 11 '22 08:11 plajjan

Most likely fixed in fae6290387850bfddbe4e9c1255750a65568b763

motiejus avatar Jun 20 '23 07:06 motiejus

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 avatar Jun 22 '23 08:06 plajjan