Repository navigation
cmake: only apply nix include dirs workaround inside nix - #401
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste |
|
Failure in https://github.com/bitcoin-core/libmultiprocess/actions/runs/44653065356/job/136012484932?pr=401 is not related to this PR change. See bitcoin/bitcoin#36913. |
Could you share details about your build platform? (OS, CMake version, compiler version, etc) |
ryanofsky
left a comment
There was a problem hiding this comment.
Code review ACK 9be2beb. I added this workaround in #184 for clang-tidy in Nix shells, and it should have been limited to Nix from the start: outside Nix there are no NIX_CFLAGS_COMPILE paths to recover, so all it does is turn the compiler's built-in include directories into explicit -isystem flags, which can put /usr/include ahead of the C++ standard library headers the tool uses. The build • macos job runs clang-tidy outside Nix and still passes with the workaround turned off, which confirms it isn't needed there.
This also fits with #333, which rewrites the comment on this workaround to explain that Nix compiler wrappers inject these include paths themselves, and that clang-tidy no longer needs the workaround after NixOS/nixpkgs#462747, so only the nixpkgs IWYU wrapper still does. The two PRs merge cleanly with each other.
It would still be good to have the platform details hebasto asked for, since it's not obvious why the compiler's own libc++ include directory, which should also be in the implicit list ahead of /usr/include, didn't take precedence. My guess is IWYU was built against a different LLVM version than clang++.
|
Ops I think I missed last Hebasto comment, but answering now: OS: Arch Linux 7.2.14-arch1-1 cmake command: clang and IWYU are built on the same LLVM version (23.1.4), so a version mismatch isn't the cause. |
Building with IWYU and libc++ on Linux machine fails with:
With
MP_ENABLE_IWYUorMP_ENABLE_CLANG_TIDY, the Nix include-dirs workaround passes the compiler's implicit include dirs as explicit-isystemflags, so/usr/includelands ahead of libc++'s headers and this causes it to fail.Apply Nix workaround only when
NIX_CFLAGS_COMPILEis set so it doesn't affect unrelated builds.