Subject: clang-16: unable to find standard headers like <cassert>
Package: clang-16
Version: 1:16.0.6-19
Severity: normal

This broke recently:

```
$ echo '#include <cassert>' > cassert.cc
$ c++ cassert.cc
cassert.cc:1:10: fatal error: 'cassert' file not found
#include <cassert>
         ^~~~~~~~~
1 error generated.
```

My c++ is an /etc/alternatives pointer to /usr/bin/clang++ which is a symlink to /usr/lib/llvm-16/bin/clang++ .

```
$ c++ -v
Debian clang version 16.0.6 (19)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i586-linux-gnu/4.7
Found candidate GCC installation: /usr/bin/../lib/gcc/i586-linux-gnu/4.7.4
Found candidate GCC installation: /usr/bin/../lib/gcc/i586-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/i586-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/14
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.4.6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.5.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/14
Candidate multilib: .;@m64
Selected multilib: .;@m64
```

Here's the clang -cc1 invocation, this shows the results of the driver search:

```
$ c++ -### cassert.cc
Debian clang version 16.0.6 (19)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
 "/usr/lib/llvm-16/bin/clang" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "cassert.cc" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=/home/nicholas" "-resource-dir" "/usr/lib/llvm-16/lib/clang/16" "-internal-isystem" "/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++" "-internal-isystem" "/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/x86_64-linux-gnu" "-internal-isystem" "/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/backward" "-internal-isystem" "/usr/lib/llvm-16/lib/clang/16/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir=/home/nicholas" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-fcolor-diagnostics" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "/tmp/cassert-0fb9fc.o" "-x" "c++" "cassert.cc"  "/usr/bin/ld" "-pie" "--hash-style=gnu" "--build-id" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "a.out" "/lib/x86_64-linux-gnu/Scrt1.o" "/lib/x86_64-linux-gnu/crti.o" "/usr/bin/../lib/gcc/x86_64-linux-gnu/14/crtbeginS.o" "-L/usr/bin/../lib/gcc/x86_64-linux-gnu/14" "-L/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../lib64" "-L/lib/x86_64-linux-gnu" "-L/lib/../lib64" "-L/usr/lib/x86_64-linux-gnu" "-L/usr/lib/../lib64" "-L/usr/lib/llvm-16/bin/../lib" "-L/lib" "-L/usr/lib" "/tmp/cassert-0fb9fc.o" "-lstdc++" "-lm" "-lgcc_s" "-lgcc" "-lc" "-lgcc_s" "-lgcc" "/usr/bin/../lib/gcc/x86_64-linux-gnu/14/crtendS.o" "/lib/x86_64-linux-gnu/crtn.o"
```

Simplifying the paths, I see:
  -internal-isystem /usr/include/c++
  -internal-isystem /usr/include/c++/x86_64-linux-gnu
  -internal-isystem /usr/include/c++/backward
  -internal-isystem /usr/lib/llvm-16/lib/clang/16/include
  -internal-isystem /usr/local/include
  -internal-isystem /usr/x86_64-linux-gnu/include
  -internal-externc-isystem /usr/include/x86_64-linux-gnu
  -internal-externc-isystem /include
  -internal-externc-isystem /usr/include

```
$ dpkg -S cassert | grep /cassert$
libstdc++-5-dev:amd64: /usr/include/c++/5/cassert
libcu++-dev: /usr/include/cuda/std/detail/libcxx/include/cassert
libcu++-dev: /usr/include/cuda/std/cassert
libstdc++-11-dev:amd64: /usr/include/c++/11/cassert
libstdc++-12-dev:amd64: /usr/include/c++/12/cassert
libstdc++-8-dev:amd64: /usr/include/c++/8/cassert
libboost1.83-dev:amd64: /usr/include/boost/compatibility/cpp_c_headers/cassert
libstdc++6-4.4-dev: /usr/include/c++/4.4/cassert
libstdc++-6-dev:amd64: /usr/include/c++/6/cassert
libc++-16-dev:amd64: /usr/lib/llvm-16/include/c++/v1/cassert
libstdc++6-4.6-dev: /usr/include/c++/4.6/cassert
libstdc++-4.9-dev:amd64: /usr/include/c++/4.9/cassert
libstdc++-9-dev:amd64: /usr/include/c++/9/cassert
libstdc++-4.8-dev:amd64: /usr/include/c++/4.8/cassert
g++-mingw-w64-i686-posix: /usr/lib/gcc/i686-w64-mingw32/13-posix/include/c++/cassert
libstdc++6-4.5-dev: /usr/include/c++/4.5/cassert
g++-mingw-w64-i686-win32: /usr/lib/gcc/i686-w64-mingw32/13-win32/include/c++/cassert
libstdc++-13-dev:amd64: /usr/include/c++/13/cassert
libstdc++-9-dev-arm64-cross: /usr/aarch64-linux-gnu/include/c++/9/cassert
libstdc++-10-dev:amd64: /usr/include/c++/10/cassert
libstdc++6-4.7-dev:amd64: /usr/include/c++/4.7/cassert
```

Nick

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (500, 'testing'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.6.13-amd64 (SMP w/24 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=en_CA.utf8, LC_CTYPE=en_CA.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: SELinux: enabled - Mode: Permissive - Policy name: default

Versions of packages clang-16 depends on:
ii  binutils                2.41.90.20240122-1
ii  libc6                   2.37-14
ii  libc6-dev               2.37-14
ii  libclang-common-16-dev  1:16.0.6-19
ii  libclang-cpp16          1:16.0.6-19
ii  libclang1-16            1:16.0.6-19
ii  libgcc-13-dev           13.2.0-12
ii  libgcc-s1               14-20240127-1
ii  libllvm16               1:16.0.6-19
ii  libobjc-13-dev          13.2.0-12
ii  libstdc++-13-dev        13.2.0-12
ii  libstdc++6              14-20240127-1
ii  llvm-16-linker-tools    1:16.0.6-19

Versions of packages clang-16 recommends:
ii  llvm-16-dev  1:16.0.6-19
ii  python3      3.11.6-1

Versions of packages clang-16 suggests:
pn  clang-16-doc  <none>
pn  wasi-libc     <none>

-- debconf-show failed

Reply via email to