Intermittent `error: unable to build compiler_rt: FileNotFound` from `zig cc`
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: FileNotFounderror: 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 invokeszig ccto compile that- the generated .h and .c files are written to a random temporary directory, like
/tmp/acton-23ha3sASc4Mf
- the generated .h and .c files are written to a random temporary directory, like
- 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 ccat least twice for each program (compiles acton module separately and then builds final executable) - tests are compiled and run concurrently, so
zig ccis potentially running concurrently
- test suite consists of ~100 small acton programs, so actonc is run on each and invokes
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 testuntil 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
--verboseto thezig ccinvocation, 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!
Most likely fixed in fae6290387850bfddbe4e9c1255750a65568b763
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.