nix-shell and gcc version

608 views
Skip to first unread message

Marko Poikonen

unread,
Feb 7, 2018, 9:40:06 AM2/7/18
to nix-devel
Hello,

This goes beyond me:

$ nix-shell -p gcc5
[nix-shell:~]$ gcc --version
gcc (GCC) 6.4.0

I am in serious need for gcc 5.4.

Br,
Marko

Justin Humm

unread,
Feb 7, 2018, 9:50:12 AM2/7/18
to Marko Poikonen, nix-devel
Hello Marko,

I experience the following on nixos-17.09:


$ nix-shell -p gcc5 --pure
[nix-shell:~]$ gcc --version
gcc (GCC) 5.4.0
Copyright (C) 2015 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.


Maybe you need the --pure flag?

Best,
Justin

Quoting Marko Poikonen (2018-02-07 15:40:06)
> --
> You received this message because you are subscribed to the Google Groups "nix-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nix-devel+...@googlegroups.com.
> To post to this group, send email to nix-...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/nix-devel/0225b832-c7bf-40be-8ec5-c064d0f39376%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
signature.asc

Will Dietz

unread,
Feb 7, 2018, 10:23:37 AM2/7/18
to Justin Humm, Marko Poikonen, nix-devel
"nix-shell -p" is based on stdenv IIRC, not stdenvNoCC, so it pulls in
default cc (currently gcc6) every time.

This is unfortunate.

Nix 2's "nix run" has better behavior:

-----------------
$ nix run -f channel:nixos-17.09 gcc5

[will@dtznix:~]$ gcc --version
gcc (GCC) 5.4.0

-----------------

Otherwise you can try to do what nix-shell does with your own
expression and feed it to nix-shell? Hopefully using 2 is an option,
simpler :).

Related: why doesn't nix-shell use stdenvNoCC (or "mkShell"), anyway?
Compat concerns?

~Will
> To view this discussion on the web visit https://groups.google.com/d/msgid/nix-devel/151801500980.6574.13507197423635573477%40maschine.

Marko Poikonen

unread,
Feb 7, 2018, 11:09:27 AM2/7/18
to nix-devel
On Wednesday, 7 February 2018 16:23:37 UTC+1, Will Dietz wrote:
Nix 2's "nix run" has better behavior:

-----------------
$ nix run -f channel:nixos-17.09 gcc5

[will@dtznix:~]$ gcc --version
gcc (GCC) 5.4.0


Cool thanks that did the trick.

Br,
Marko
Reply all
Reply to author
Forward
0 new messages