Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idris: Wrap with IDRIS_CC #42855

Merged
merged 2 commits into from Jul 4, 2018
Merged

Idris: Wrap with IDRIS_CC #42855

merged 2 commits into from Jul 4, 2018

Conversation

infinisil
Copy link
Member

Motivation for this change

Previously idris used the C compiler from PATH for the C backend, which
means that the results and whether it even succeeds can vary between
systems (e.g. if a Nix-built Idris was used on a super old Linux system,
the cc installed there might not even work for Idris' C).

To make this more predictable, this commit sets the IDRIS_CC env var,
which Idris will prefer over searching in PATH, to a Nix-provided gcc
executable, given that it is not already set, so it's still possible to
override.

This closes #42785

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Previously idris used the C compiler from PATH for the C backend, which
means that the results and whether it even succeeds can vary between
systems (e.g. if a Nix-built Idris was used on a super old Linux system,
the cc installed there might not even work for Idris' C).

To make this more predictable, this commit sets the IDRIS_CC env var,
which Idris will prefer over searching in PATH, to a Nix-provided gcc
executable, given that it is not already set, so it's still possible to
override.
@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: idris

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: idris

Partial log (click to expand)

Installing 00base-idx.ibc to /nix/store/zjgvqj0gr2sn55lwya9v191s7z3zjxyv-base-1.3.0/libs/base
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/zjgvqj0gr2sn55lwya9v191s7z3zjxyv-base-1.3.0
strip is /nix/store/4qvrxzxa535y8304mk195x50b6p9607d-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/zjgvqj0gr2sn55lwya9v191s7z3zjxyv-base-1.3.0
checking for references to /build in /nix/store/zjgvqj0gr2sn55lwya9v191s7z3zjxyv-base-1.3.0...
building '/nix/store/5ajbmgk1d2rqm24dkr6f1k9wr3dvs53g-idris-1.3.0.drv'...
/nix/store/2abwwl9fiasyg9504ys6h0608yyffnsj-idris-1.3.0/nix-support:
propagated-build-inputs: /nix/store/zjgvqj0gr2sn55lwya9v191s7z3zjxyv-base-1.3.0/nix-support/propagated-build-inputs
/nix/store/r39cbhfgrvlzzkv4699mcwfsydpncbnz-idris-1.3.0

@infinisil
Copy link
Member Author

infinisil commented Jul 2, 2018

Ping @brainrape @shlevy @ttuegel

--suffix LIBRARY_PATH : ${stdenv.lib.makeLibraryPath lib}
'';
}
--run 'export IDRIS_CC=''${IDRIS_CC:-${lib.getBin gcc}/bin/gcc}' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not, --set really sets it equal to exactly the string you give it, can't expand any variables (it uses bash's ${parameter@operator} "Parameter transformation" with operator=Q, see man bash). --run is the next best way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. All good then.

@brainrake
Copy link
Contributor

brainrake commented Jul 3, 2018

Thanks @infinisil this is great for reproducibility and customizability.

@brainrake
Copy link
Contributor

Good to merge.

@infinisil infinisil merged commit 45f8c2a into NixOS:master Jul 4, 2018
@infinisil infinisil deleted the idris-gcc branch July 4, 2018 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

idris's wrapper should set IDRIS_CC to reduce the risk of accidentally using the wrong CC version
3 participants