Nixpkgs: gcc10 resolving to gcc 9.3.0

Created on 4 Jun 2020  路  2Comments  路  Source: NixOS/nixpkgs

Describe the bug

When I try to install gcc10 using nix-shell --pure -p gcc10, it seems to install gcc10. However, it's not available in the path and somehow gcc 9.3.0 is available in the path.

To Reproduce
Steps to reproduce the behavior:

nix-shell --pure -p gcc10
gcc --version

Expected behavior

I'd expect that gcc10 is available in the path after making a shell with the command listed above.

Actual behavior

$ gcc --version
gcc (GCC) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Additional context

It seems like gcc10 is actually added to my store when running the command. I see that /nix/store/hzzgaw8ga9sfa8nk97h3xdmrhbdc55lj-gcc-10.1.0 is created and it indeed contains gcc10. However, I'd expect that making a pure shell with gcc10 would not result in the gcc9 package being available.

I also don't have gcc installed in my profile (nixos/configuration).

What's weird is that doing this does resolve to gcc10:

#shell.nix
with import <nixpkgs> {}; {
  qpidEnv = stdenvNoCC.mkDerivation {
    name = "gcc10-environment";
    buildInputs = [
      pkgs.gcc10
    ];
  };
}

Notify maintainers

@Synthetica9 @vnucat (can't tag, don't know why...)

Metadata

  • system: "x86_64-linux"
  • host os: Linux 5.6.15-hardened, NixOS, 20.09pre227577.135073a87b7 (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.5
  • channels(rick): ""
  • channels(root): "nixos-20.09pre228204.467ce5a9f45, nixpkgs-20.09pre228204.467ce5a9f45"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
bug

Most helpful comment

The pure shell contains stdenv and gcc10. But stdenv itself contains gcc9. You must use gcc10Stdenv instead of stdenv. This cannot be done on the command line only, you must use a file:

with import <nixpkgs> {};
gcc10Stdenv.mkDerivation {
name="foo";
buildInputs = [];
}

and then nix-shell thefile.nix.

All 2 comments

The pure shell contains stdenv and gcc10. But stdenv itself contains gcc9. You must use gcc10Stdenv instead of stdenv. This cannot be done on the command line only, you must use a file:

with import <nixpkgs> {};
gcc10Stdenv.mkDerivation {
name="foo";
buildInputs = [];
}

and then nix-shell thefile.nix.

Okay, I guess this isn't an issue then. The behavior did feel confusing though. I did not expect gcc9 slipping in like that.

Thanks for the information!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yawnt picture yawnt  路  3Comments

copumpkin picture copumpkin  路  3Comments

tomberek picture tomberek  路  3Comments

ghost picture ghost  路  3Comments

domenkozar picture domenkozar  路  3Comments