On Fri, Mar 03, 2023 at 05:31:41PM +0000, Simon McVittie wrote:
> # 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:

(Super helpful bug report, thanks!)

As I mentioned in #1029010 just now, this is a regression from 14->15.
Retracing the same steps with clang-14 & libc++-14-dev-wasm32, there are
no errors and everything works as intended.

Looking at the differences of the include paths between the two by
passing -v to clang, one can see:
  /usr/include/wasm32-wasi/c++/v1
- /usr/lib/llvm-14/lib/clang/14.0.6/include
+ /usr/include/c++/v1
+ /usr/lib/llvm-15/lib/clang/15.0.7/include
  /usr/local/include
  /usr/include/wasm32-wasi
  /usr/include
i.e. /usr/include/c++/v1 (i.e. libc++-15-dev) is included in the include
path only with clang-15. It shouldn't be.

Looking at the interdiff of d/patches/wasm/wasm-sysroot-usr.diff[1]
patch between llvm-toolchain 1:14.0.6-12 and 1:15.0.7-1, it looks line
there are a few hunks that are missing.

Specifically, it looks like the entire patching of the method
WebAssembly::AddClangCXXStdlibIncludeArgs isn't happening anymore. One
of these differences was exactly about this -- the comment says:
  // don't include the host architecture's headers in the search path

Sylvestre, I think you did the 14->15 porting, right? Do you
know/remember what happened there?

Regards,
Faidon

1: Note that the git tree also has d/patches/wasm-sysroot-usr.diff (and
d/patches/wasm-compiler-rt-default.diff) which are earlier versions of
this patch, now unused (not in d/patches/series). I think what happened
was that the files were copied, instead of moved, to d/patches/wasm/.
Here I am talking exclusively about the versions in d/patches/wasm/.
It'd be good to cleanup this cruft to avoid further confusion.

Reply via email to