[Nix-dev] NIX_ENFORCE_NO_NATIVE
Andreas Herrmann
andreash87 at gmx.ch
Sun Jun 12 12:08:39 CEST 2016
On Thursday 09 June 2016 10:51:30 Vladimír Čunát wrote:
> On 06/09/2016 10:17 AM, Andreas Herrmann wrote:
> >> IIRC its' conditioned on $NIX_ENFORCE_NO_NATIVE exactly in order
> >> not to be filtered out when run outside a nix builder. IMO that's a
> >> good default. Hydra isn't the only reason; many devs use remote
> >> builds or nix-copy-closure.
> > How would you nix-copy-closure something that was compiled outside of
> > nix? Maybe, we're talking about different things. What I mean is
> > using a GCC that was built by Nix directly on the command-line
>
> You seem to have missed my main point, so let me be more clear.
>
> 1) Outside nix builder $NIX_ENFORCE_NO_NATIVE is *not* active unless you
> explicitly set it, i.e. -march=native *is* passed to the underlying GCC.
> I re-tested that now by reading code and using (2).
Thanks for clarifying that. I did indeed not get that point. I do all my development within nix-shells nearly all the time. I should have mentioned that in the beginning, sorry. It seems that it would be difficult to distinguish gcc being called from within a nix-builder to it being called on the command-line within a nix-shell.
> 2) If you set NIX_DEBUG=1 those omission won't be silent:
> $ env NIX_ENFORCE_NO_NATIVE=1 NIX_DEBUG=1 g++ [...]
> skipping impure path -march=native
> [...]
>
> (Yes, in this case it's not very friendly to call it a path.)
I did not know about that flag. Thanks for mentioning it.
I still think that a more verbose kind of warning would be preferable in that particular case.
I guess for now I will have to develop a habit of running my nix builds with NIX_DEBUG=1 after an update of the package set to see if any compiler flags have changed.
Best, Andreas
More information about the nix-dev
mailing list