Skip to content

Clang response files break ccache #119779

Closed

Description

@Kha

Describe the bug
#112449 hides clang arguments in a "response file" by default if isClang is true, but ccache does not support this and responds with "no input files" instead.

Additional context
The following workaround can be used to disable response files in a ccacheWrapper result cc, fixing the issue:

  cc.overrideAttrs (old: {
    installPhase = builtins.replaceStrings ["use_response_file_by_default=1"] ["use_response_file_by_default=0"] old.installPhase;
  })

Notify maintainers
@angerman

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: ccacheWrapper ccacheStdenv
# a list of nixos modules affected by the problem
module: programs.ccache

Activity

  1. added
    0.kind: bug
    on Apr 18, 2021
  2. rrbutani commented on Mar 20, 2022

    @rrbutani
    Contributor

    I've run into this issue as well.

    Can we perhaps add a export NIX_CC_USE_RESPONSE_FILE=0 to the ccache-links wrapper (gated on isClang, maybe)?
    Edit: my bad, that doesn't work; we need the env var to be set before the outer layer of stdenv wrapper machinery runs. By the time we're in the ccache wrapper it's too late.

    It's also not clear to me if this is a bug in ccache or intended behavior (I was not able to find an issue for it upstream) but it's definitely reproducible:

    # Okay:
    nix-shell -p stdenv --run 'bash -c "cc @<(echo --version)"'
    
    # Not okay:
    nix-shell -p ccache --run 'bash -c "ccache cc @<(echo --version)"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions