Inappropriate use of -isystem to locate the LLVM-embedded siphash header file?
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
I initially tried to report this problem to the rust folks, ref. [Rust issue 148450](https://github.com/rust-lang/rust/issues/148450) but I got redirected here since the claim is that this is really an "upstream LLVM" issue.
To explain where I'm coming from: In my efforts to keep the various rust targets on NetBSD built & running, I'm cross-building rust for the various targets on NetBSD/amd64 as a host. The monthly rust release tarballs contain an embedded version of LLVM which also needs to be cross-built. With the recent release of rust 1.91.0, I found a new problem which crops up.
Rust 1.90.0 has LLVM version 20.1.8 embedded.
Rust 1.91.0 has LLVM version 21.1.2 embedded.
In the cross-compilation setup I'm using, some of the compiler arguments have to be added to or transformed. In particular, `--sysroot=/target/root` needs to be added, and `-isystem /some/dir` is transformed to `-isystem =/some/dir` (to get the sysroot prepended), on the assumption that `-isystem` is used to indicate where the "system-supplied headers" are to be searched for (they may vary in important ways between different target systems). It then becomes problematic to use `-isystem` to point to a directory inside the LLVM source distribution, and in my opinion, the `-I` option should have been used in that case instead. The fatal build error I observed was:
```
/usr/pkgsrc/wip/rust191/work/rustc-1.91.0-src/src/llvm-project/llvm/lib/Support/SipHash.cpp:15:10: fatal error: siphash/SipHash.h: No such file or directory
#include "siphash/SipHash.h"
^~~~~~~~~~~~~~~~~~~
compilation terminated.
```
More details about the compiler invocation can be found in the rust issue referred to above.
I found a temporary hackish workaround by modifying my "gcc wrapper script" to rewrite this particular `-isystem` usage to use `-I` instead, but ... that should not have been required.
I have made a feeble attempt at locating where this particular `-isystem` comes from within the LLVM build system, but at least grep'ing for `isystem` reveals far too many occurrences to wade through, and also matching with `siphash` then gives me no matches. So some assistance from someone more versed in the LLVM build system would be much appreciated.
So ... can anyone help?
Contributor guide
Research direction
Start with src/llvm-project/llvm/lib/Support/SipHash.cpp and the siphash/SipHash.h include, then inspect the compiler invocation referenced by Rust issue 148450 to trace where the -isystem path is generated. Check the LLVM build configuration that supplies this include path. Done means the embedded SipHash header is found during the reported cross-build without a compiler-wrapper rewrite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100