Issue 117438
Summary [clang] clang -M should print expanded paths
Labels clang
Assignees
Reporter xtexChooser
    When using `clang -M`, some c++ standard library headers' paths are not real paths.

For example, on AOSC OS (a usr-merged Linux distribution), `/bin/../lib64/gcc/` ... are emitted. These paths are valid for IO operations (`/bin` is linked to `/usr/bin` on usr-merged distributions, thus `/bin/../lib64` is equivalent to `/usr/lib64`), but not for Make and Ninja. Both make and ninja canonicalize them to `/lib64`, which does not exist, and they always regards these targets as dirty and rebuilds them everytime.

```
xtex@xtex1 ~ (main)> cat test.cpp
#include <cstdio>

int main() { return 0; }
xtex@xtex1 ~ (main)> clang -M test.cpp
test.o: test.cpp \
 /bin/../lib64/gcc/x86_64-aosc-linux-gnu/13.2.0/../../../../include/c++/13.2.0/cstdio \
 /bin/../lib64/gcc/x86_64-aosc-linux-gnu/13.2.0/../../../../include/c++/13.2.0/x86_64-aosc-linux-gnu/bits/c++config.h \
 /bin/../lib64/gcc/x86_64-aosc-linux-gnu/13.2.0/../../../../include/c++/13.2.0/pstl/pstl_config.h \
  /usr/include/tbb/tbb.h /usr/include/stdio.h \
 /usr/include/bits/libc-header-start.h \
 /usr/lib/clang/18/include/stdarg.h \
(some paths are emitted)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to