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

llvm-4: small improvements on Darwin and elsewhere #24014

Merged
merged 1 commit into from Mar 18, 2017

Conversation

copumpkin
Copy link
Member

@copumpkin copumpkin commented Mar 18, 2017

Split outputs because there's no point in keeping a reference to Python and it causes trouble during the Darwin stdenv bootstrap. There's also an unnecessary dependency on LLVM in libc++ which causes us to rebuild LLVM several more times than necessary during bootstrap, and an awkward
dependency on XPC in the TSAN that we turn off.

I'm getting an internal g++ error when I try to compile clang 4 with this on NixOS. Can someone give it a go on their machine and see if it's just me? I can't see how I'd cause the internal error with the changes I made... Turns out the internal error was due to being memory-constrained. It worked fine on another machine with more memory.

Motivation for this change

This is in preparation for using LLVM 4 in the Darwin stdenv and by default across nixpkgs.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • 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/)
  • Fits CONTRIBUTING.md.

Split outputs because there's no point in keeping a reference to Python
and it causes trouble during the Darwin stdenv bootstrap. There's also
an unnecessary dependency on LLVM in libc++ which causes us to rebuild
LLVM several more times than necessary during bootstrap, and an awkward
dependency on XPC in the TSAN that we turn off. This is in preparation
for using LLVM 4 in the Darwin stdenv and by default across nixpkgs.
@mention-bot
Copy link

@copumpkin, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dtzWill to be a potential reviewer.

@@ -29,12 +29,23 @@ let
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
'';

outputs = [ "out" "python" ];
Copy link
Member Author

Choose a reason for hiding this comment

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

Are we splitting outputs by default nowadays? Should I include other outputs here?

@c0bw3b
Copy link
Contributor

c0bw3b commented Mar 18, 2017

Trying this on NixOS :

$ nix-shell -p nox --run "nox-review -k pr 24014"
[...]
error: while querying the derivation named ‘freecell-solver-4.8.0’:
while evaluating the attribute ‘nativeBuildInputs’ of the derivation ‘freecell-solver-4.8.0’ at /home/demo/.nox/nixpkgs/pkgs/games/freecell-solver/default.nix:8:3:
[...]

@copumpkin
Copy link
Member Author

@c0bw3b that sounds like someone broke evaluation somewhere?

@c0bw3b
Copy link
Contributor

c0bw3b commented Mar 18, 2017

Yes. I get the same error when running nox-review on PR #23161 actually. :/
So this is not related to your commit.

@copumpkin
Copy link
Member Author

Yeah, looks like @7c6f434c fixed it in d221e40, thanks!

@c0bw3b
Copy link
Contributor

c0bw3b commented Mar 18, 2017

Rerun nox-review here and it completed successfully.

/nix/store/m9pnn0bnaaigjln132d2kh8xsyhp10vl-clang-wrapper-4.0.0
Result in /run/user/1000/nox-review-tj77hy_q
total 0
lrwxrwxrwx 1 demo users 63 18 mars  18:48 result -> /nix/store/m9pnn0bnaaigjln132d2kh8xsyhp10vl-clang-wrapper-4.0.0

Checking the resulting derivation :

[demo@nixos:~]$ tree -ah /nix/store/m9pnn0bnaaigjln132d2kh8xsyhp10vl-clang-wrapper-4.0.0
/nix/store/m9pnn0bnaaigjln132d2kh8xsyhp10vl-clang-wrapper-4.0.0
├── [4.0K]  bin
│   ├── [  64]  as -> /nix/store/k8c23rwbrril65rmm7z1036h2makk012-binutils-2.28/bin/as
│   ├── [   7]  c++ -> clang++
│   ├── [   5]  cc -> clang
│   ├── [5.7K]  clang
│   ├── [5.8K]  clang++
│   ├── [5.7K]  cpp
│   ├── [5.5K]  ld
│   ├── [5.6K]  ld.bfd
│   └── [5.6K]  ld.gold
└── [4.0K]  nix-support
    ├── [1.7K]  add-flags.sh
    ├── [2.2K]  add-hardening.sh
    ├── [  63]  cc-cflags
    ├── [  63]  cc-ldflags
    ├── [  80]  dynamic-linker
    ├── [ 233]  libc-cflags
    ├── [  61]  libc-ldflags
    ├── [  96]  libc-ldflags-before
    ├── [  56]  orig-cc
    ├── [  55]  orig-libc
    ├── [  59]  orig-libc-dev
    ├── [   1]  propagated-native-build-inputs
    ├── [ 173]  propagated-user-env-packages
    ├── [1.4K]  setup-hook
    └── [1.2K]  utils.sh

2 directories, 24 files

[demo@nixos:~]$ /nix/store/m9pnn0bnaaigjln132d2kh8xsyhp10vl-clang-wrapper-4.0.0/bin/clang --version
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/m0wld6jq7xw2cnchrxijyri0xw44svpq-clang-4.0.0/bin

@copumpkin
Copy link
Member Author

@c0bw3b thanks for checking! The build also ran fine on my other Linux machine, so I'll merge.

@copumpkin copumpkin merged commit e965d6d into NixOS:master Mar 18, 2017
@dtzWill
Copy link
Member

dtzWill commented Mar 18, 2017

  • LLVM 4 as default Darwin stdenv 👍
  • In my research branch I've nuked the same to reduce runtime deps on python and libxml2 (c-index-test). I think you gave me the idea O:).
  • Probably should move $out/share/scan-view as well? Contains various python scripts....

@dtzWill
Copy link
Member

dtzWill commented Mar 18, 2017

Not runtime dependency (as discussed on IRC), but perhaps the supporting python bits for scan-view should be moved as well?

$ git rev-parse HEAD
4707ac31f1a8406aaa6b8d892512fe59388349a5
$ nix-build -A clang_4.cc
/nix/store/m0wld6jq7xw2cnchrxijyri0xw44svpq-clang-4.0.0
$ ls -l result
lrwxrwxrwx 1 will users 55 Mar 18 14:19 result -> /nix/store/m0wld6jq7xw2cnchrxijyri0xw44svpq-clang-4.0.0
$ tree -ah ./result/share
./result/share
├── [4.0K]  clang
│   ├── [1.4K]  clang-format-bbedit.applescript
│   ├── [7.0K]  clang-format.el
│   ├── [ 17K]  clang-include-fixer.el
│   └── [3.1K]  clang-rename.el
├── [4.0K]  man
│   └── [4.0K]  man1
│       └── [3.7K]  scan-build.1.gz
├── [4.0K]  scan-build
│   ├── [1.3K]  scanview.css
│   └── [ 16K]  sorttable.js
└── [4.0K]  scan-view
    ├── [ 318]  bugcatcher.ico
    ├── [ 18K]  FileRadar.scpt
    ├── [   0]  GetRadarVersion.scpt
    ├── [8.0K]  Reporter.py
    ├── [ 25K]  ScanView.py
    └── [5.9K]  startfile.py

5 directories, 13 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants