Package: libc++-15-dev Version: 1:15.0.7-1 Severity: important This is a simplification of the compilation failure in #1029010.
To reproduce: $ podman run --rm -it debian:sid-slim # cat > stddef.cpp <<EOF #include <stddef.h> int main () { return sizeof (size_t); } EOF # apt-get update # apt-get upgrade # apt-get install --no-install-recommends make wasi-libc clang-15 libc++-15-dev-wasm32 # clang++-15 -c --target=wasi-wasm32 -ostddef-cpp.o stddef.cpp # apt-get install --no-install-recommends libc++-15-dev # clang++-15 -c --target=wasi-wasm32 -ostddef-cpp.o stddef.cpp Expected result: both clang++-15 calls succeed (stddef.h declares size_t) Actual result: the second clang++-15 call fails: > stddef.cpp:2:30: error: use of undeclared identifier 'size_t'; did you mean > 'sizeof'? > int main () { return sizeof (size_t); } > > ^~~~~~ > sizeof > stddef.cpp:2:36: error: expected expression > int main () { return sizeof (size_t); } > > ^ > 2 errors generated. If I just preprocess (clang++-15 -E -dI --target=wasi-wasm32 stddef.cpp), I get this (after removing blank lines): # 1 "stddef.cpp" # 1 "<built-in>" 1 # 1 "<built-in>" 3 # 368 "<built-in>" 3 # 1 "<command line>" 1 # 1 "<built-in>" 2 # 1 "stddef.cpp" 2 #include <stddef.h> /* clang -E -dI */ # 1 "stddef.cpp" # 1 "/usr/include/wasm32-wasi/c++/v1/stddef.h" 1 3 # 39 "/usr/include/wasm32-wasi/c++/v1/stddef.h" 3 #include <__config> /* clang -E -dI */ # 39 "/usr/include/wasm32-wasi/c++/v1/stddef.h" 3 # 1 "/usr/include/wasm32-wasi/c++/v1/__config" 1 3 # 13 "/usr/include/wasm32-wasi/c++/v1/__config" 3 #include <__config_site> /* clang -E -dI */ # 13 "/usr/include/wasm32-wasi/c++/v1/__config" 3 # 1 "/usr/include/wasm32-wasi/c++/v1/__config_site" 1 3 # 37 "/usr/include/wasm32-wasi/c++/v1/__config_site" 3 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wmacro-redefined" #pragma clang diagnostic pop # 14 "/usr/include/wasm32-wasi/c++/v1/__config" 2 3 # 23 "/usr/include/wasm32-wasi/c++/v1/__config" 3 # 660 "/usr/include/wasm32-wasi/c++/v1/__config" 3 namespace std { inline namespace __2 { }} # 40 "/usr/include/wasm32-wasi/c++/v1/stddef.h" 2 3 # 43 "/usr/include/wasm32-wasi/c++/v1/stddef.h" 3 #include_next <stddef.h> /* clang -E -dI */ # 45 "/usr/include/wasm32-wasi/c++/v1/stddef.h" 3 # 1 "/usr/include/c++/v1/stddef.h" 1 3 # 46 "/usr/include/wasm32-wasi/c++/v1/stddef.h" 2 3 typedef decltype(nullptr) nullptr_t; # 2 "stddef.cpp" 2 int main () { return sizeof (size_t); } which you will notice doesn't declare size_t as you might expect. If I remove libc++-15-dev and re-run preprocessing with the same command-line, I get this, which looks better in some ways but worse in others (it defines ptrdiff_t, size_t and max_align_t, but not nullptr_t): # 1 "stddef.cpp" # 1 "<built-in>" 1 # 1 "<built-in>" 3 # 368 "<built-in>" 3 # 1 "<command line>" 1 # 1 "<built-in>" 2 # 1 "stddef.cpp" 2 #include <stddef.h> /* clang -E -dI */ # 1 "stddef.cpp" # 1 "/usr/lib/llvm-15/lib/clang/15.0.7/include/stddef.h" 1 3 # 35 "/usr/lib/llvm-15/lib/clang/15.0.7/include/stddef.h" 3 typedef long int ptrdiff_t; # 46 "/usr/lib/llvm-15/lib/clang/15.0.7/include/stddef.h" 3 typedef long unsigned int size_t; # 102 "/usr/lib/llvm-15/lib/clang/15.0.7/include/stddef.h" 3 #include "__stddef_max_align_t.h" /* clang -E -dI */ # 102 "/usr/lib/llvm-15/lib/clang/15.0.7/include/stddef.h" 3 # 1 "/usr/lib/llvm-15/lib/clang/15.0.7/include/__stddef_max_align_t.h" 1 3 # 19 "/usr/lib/llvm-15/lib/clang/15.0.7/include/__stddef_max_align_t.h" 3 typedef struct { long long __clang_max_align_nonce1 __attribute__((__aligned__(__alignof__(long long)))); long double __clang_max_align_nonce2 __attribute__((__aligned__(__alignof__(long double)))); } max_align_t; # 103 "/usr/lib/llvm-15/lib/clang/15.0.7/include/stddef.h" 2 3 # 2 "stddef.cpp" 2 int main () { return sizeof (size_t); } I think this is leading to the autopkgtest failure seen in #1029010. The autopkgtest uses "Depends: @" which installs all binary packages built by the llvm-toolchain-15 source package, and as a result of this bug, /usr/include/wasm32-wasi/c++/v1/cstddef doesn't define std::size_t because there is no declaration for ::size_t, which should have come from stddef.h. Sorry, I don't know enough about the internals of libc++ to suggest a solution. smcv