llvmPackages_*.clang-unwrapped: make scan-build work
-
scan-build and c*-analyzer are written in Perl, so we need to add it as a buildInput, so the interpreter is patched.
-
For scan-build to discover c*-analyzer, the
binandlibexecdirectories need to be in the same prefix. Since this is no big trouble for clang, we can just move the libexec directory from thelibto theoutoutput.
To be tested how this interacts with bootstrapping for macOS and perhaps pkgsLLVM.
Additional perl dependency may be a problem in some cases?
Motivation for this change
Things done
- Built on platform(s)
- [x] x86_64-linux
- [ ] aarch64-linux
- [ ] x86_64-darwin
- [ ] aarch64-darwin
- [ ] For non-Linux: Is
sandbox = trueset innix.conf? (See Nix manual) - [ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
- [ ] Tested compilation of all packages that depend on this change using
nix-shell -p nixpkgs-review --run "nixpkgs-review wip" - [ ] Tested execution of all binary files (usually in
./result/bin/) -
21.11 Release Notes (or backporting 21.05 Release notes)
- [ ] (Package updates) Added a release notes entry if the change is major or breaking
- [ ] (Module updates) Added a release notes entry if the change is significant
- [ ] (Module addition) Added a release notes entry if adding a new NixOS module
- [x] Fits CONTRIBUTING.md.
Checked build & it works
Unsure whether this creates a problem for darwin in its current form since perl is not in bootstrap-tools I believe?
Hello, is there any update on this ? I'm having the same issue as #151367 as of now. Thanks :)
~/repos/NTNU/CSU0013
$ scan-build -V make (71e23ed)
scan-build: 'ccc-analyzer' does not exist at '/nix/store/a5v30qll5i02vr9y97bk1rdx3mm6kvlm-clang-16.0.6/bin/ccc-analyzer'
Can I get some feedback on this (again)? For me there are the following questions:
- Should we move
scan-buildtodevinstead ofbin? - What about the closure size with
perlincluded? Would it be better to require the user ofscan-buildto “bring their own perl” and leave the/usr/bin/env perlshebang unpatched?
Haven't had much of a look, but please no unpatched shebangs — it would make it not run in the Nix sandbox, where there's no /usr/bin/env.
This PR has merge conflicts, has gotten stale, and has CI failures, is this PR still something we want to have done?
Yes, we probably should. It's still an issue that scan-build doesn't work.
Alright, any plans on rebasing the PR to resolve the conflicts?
Are there any plans to move forward with this PR? This is still an open issue.
@sternenseemann I'd love to see this land - not a contributor, but anything I can do to help?
but anything I can do to help?
Unfortunately not, this PR requires rebasing which @sternenseemann has to do.
I'll try and remember to do it soon, sorry!
Redid the entire change on current nixpkgs and also made scan-build-py work (which is trivial). The change for scan-build is more conservative now and relies on an impure perl to avoid closure size concerns. I think we should probably integrate scan-build into clang-tools in the future to solve this. (Or add a perl output to clang, but ugh…)
@RossComputerGuy Just found this again… Do we still want to do this?
Do we still want to do this?
If we want the tools still, sure