cache-nix-action icon indicating copy to clipboard operation
cache-nix-action copied to clipboard

[BUG] Restoring cache appears to be missing files (e.g. libgcc_s.so.1)

Open obreitwi opened this issue 1 year ago • 16 comments

Describe the bug

When building in a restored cache, the builder is unable to find libgcc_s.so.1.

This leads to various errors, such as:

/nix/store/00mg4vlhzmm7gi9bd5v5ydjlgrywpc3n-go-1.22.3/share/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 
/nix/store/bgcaxhhxswzvmxjbbgvvaximm5hwghz1-binutils-2.41/bin/ld: cannot find -lgcc_s: No such file or directory            
collect2: error: ld returned 1 exit status                                                                                  

when building a go service via gomod2nix or

closure-paths> python3: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
error: builder for '/nix/store/gyb8h4dps65bbk6x6is9mxhg2akdv7vv-closure-paths.drv' failed with exit code 127

when building a docker image via dockerTools.buildLayeredImage.

To Reproduce

(Currently the error occurs in a private repo. I plan on re-creating it in a public repo for easier reproduction, but I wanted to report the issue first nonetheless)

Steps to reproduce would include:

  1. Run workflow successful with caching enabled (auto-optimize-store = false, sandbox = true), observe that all build targets get built successfully.
  2. Run the exact same workflow again with minor modifications to the source code or docker image contents, this time restoring the newly created crash.
  3. Observe one of the errors above, depending on which workflow was triggered.

Expected behavior

Restoring the cache should restore all files; to nix, it should not make a difference.

Additional context

A workaround is simply disabling the cache for now, but I want to understand what is going on… :wink:

obreitwi avatar Jun 07 '24 09:06 obreitwi