Hello all,
I have a project which I need to build using a specific C compiler (not available on nixpkgs, but just a specific version of GCC). I’ve created a derivation which builds this compiler (as newCompiler
in the example below), but I’m having some trouble bringing it in to the project derivation. In line with the instructions here: C - NixOS Wiki, I’ve tried the following:
getThisStdenv = { pkgs, ... }: with pkgs; (overrideCC stdenv newCompiler);
pkgs = import nixpkgs {
system = "x86_64-linux";
config.replaceStdenv = getThisStdenv;
};
If I then try to build, I get errors like the following:
{ bintools, libc ? if stdenv.targetPlatform != stdenv.hostPlatform then libcCross else stdenv.cc.libc
It seems that stdenv.cc
is expected to have some specific set of attributes (libc
, cc
, targetPrefix
etc), which makes me feel that my naive approach is probably not going to work.
Is there either:
- Some way to wrap the
newCompiler
package so that it works as expected - I notice there’s acc-wrapper.nix
, but how to use it isn’ clear to me, or - Some way to hack this, ie using
stdenvNoCC.mkDerivation
but then statingCC = ${newCompiler}/bin/gcc
in the derivation?
Thanks for any help!