Skip to content
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

New reproducibility NIX_CFLAGS_COMPILE breaks ccache caching #109033

Open
Kha opened this issue Jan 11, 2021 · 6 comments
Open

New reproducibility NIX_CFLAGS_COMPILE breaks ccache caching #109033

Kha opened this issue Jan 11, 2021 · 6 comments

Comments

@Kha
Copy link
Contributor

Kha commented Jan 11, 2021

Describe the bug
After #102251, a new -frandom-seed C compiler flag is inserted with a value that changes whenever the derivation hash has changed. This will change the ccache cmdline hash, completely defeating any use of ccacheWrapper etc.

Additional context
Arguably, ccache should probably ignore frandom-seed since caching modulo that value is no worse than caching a cmdline that did not contain the flag in the first place, which effectively sets it to a random value. But it would be great to be able to at least opt out of the new behavior until this is "fixed" upstream (if accepted at all).

Notify maintainers
@andir

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module: programs.ccache
@tomberek
Copy link
Contributor

tomberek commented Apr 4, 2021

The solution referenced by the lean4 package works to trim out the -frandom-seed.

@stale
Copy link

stale bot commented Oct 1, 2021

I marked this as stale due to inactivity. → More info

@Atemu
Copy link
Member

Atemu commented Apr 15, 2023

Upstream has added support for the flag. ccache/ccache#1168

You need explicitly enable it via sloppiness = random_seed in the ccache config file though.

Given that we enable it for all packages by default, perhaps ccacheStdenv should enable it by default too.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 15, 2023
@timgott
Copy link

timgott commented Jul 3, 2023

You can also enable that flag with an environment variable similar to how you set CCACHE_DIR according to https://nixos.wiki/wiki/CCache, by adding

export CCACHE_SLOPPINESS=random_seed

in extraConfig

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/bisect-linux-kernel-without-recompiling-every-time/42633/3

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/really-low-ccache-hit-rates-when-overriding-a-package/47421/4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants