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
ccache doesn't work for linux kernel #153343
Comments
Easy workaround: nix.sandboxPaths = [ (toString config.programs.ccache.cacheDir) ]; |
@aviallon do you have more info on that? I still get the error |
context of ccache.nix:55 # target configuration
(mkIf (cfg.packageNames != []) {
nixpkgs.overlays = [
(self: super: genAttrs cfg.packageNames (pn: super.${pn}.override { stdenv = builtins.trace "with ccache: ${pn}" self.ccacheStdenv; })) so the but
probably this will not work, cos not implemented programs.ccache.packageNames = [ "linuxPackages_latest.kernel" ]; |
I tried setting |
{
nixpkgs.overlays = [
(self: super: {
linuxPackages_latest.kernel = super.linuxPackages_latest.kernel.override {
stdenv = self.ccacheStdenv;
};
})
]; ? you probably also need
then you can
(not sure about the cache path) |
@milahu Thanks so much for the help! I just tried that, and unfortunately it doesn't seem to work — I get:
Any idea what's up? |
workaround: programs.ccache.enable = true;
programs.ccache.cacheDir = "/opt/ccache";
programs.ccache.packageNames = [ "linuxPackages_5_19.kernel" ];
nix.settings.extra-sandbox-paths = [ "/opt/ccache" ];
nixpkgs.overlays = [
(self: prev: {
kernel_cache = (prev.linuxPackages_5_19.kernel.override {
stdenv = self.ccacheStdenv;
buildPackages = prev.buildPackages // {
stdenv = self.ccacheStdenv;
};
}).overrideDerivation (attrs: {
preConfigure = ''
export NIX_CFLAGS_COMPILE="$(echo "$NIX_CFLAGS_COMPILE" | sed -e "s/-frandom-seed=[^-]*//")"
'';
});
})
];
boot = {
kernelPackages = pkgs.linuxPackagesFor pkgs.kernel_cache;
kernelPatches = [
{
name = "fix-something";
patch = /opt/linux_5_19_9/linux.patch;
extraConfig = ''
'';
}
];
};
|
@patryk4815 |
Curious if someone has an example of it working. It seems to be breaking because the ccache wrapper isn't outputting the right version information? Not entirely sure how the ccache wrapper works and do not want to go down the rabbit hole of figuring it out if it isn't necessary. The exact same build works with normal
This is the kernel script that causes the error and what is being invoked. Interestingly calling the script manually with This is an excerpt of my kernel derivation (full source is here): ((callPackage "${nixpkgs}/pkgs/os-specific/linux/kernel/manual-config.nix" {})
{
inherit src modDirVersion version kernelPatches configfile;
inherit lib;
stdenv = ccacheStdenv;
....
})
.overrideAttrs (old: {
preConfigure = lib.optionalString ccache.enable ''
export CCACHE_DIR=${ccache.dir}
export CCACHE_UMASK=007
'';
...
}) |
I encountered a similar issue as @jordanisaacs, and after some investigation, I realized that I had forgotten to update the Initially, I wasn't receiving any error messages from I hope this information helps others who might encounter a similar issue. |
Describe the bug
I am trying to use ccache to compile the linux kernel with the following config:
But I get the following error:
Steps To Reproduce
/etc/nixos/configuration.nix
nixos-rebuild switch
Expected behavior
Kernel is built using ccache.
Additional context
#62121 may be related?
Notify maintainers
Not sure who this belongs to :(
Metadata
The text was updated successfully, but these errors were encountered: