Dear Maintainers,I have looked further into this and I think these lines in the patch file at debian/patches/wasm/wasm-sysroot-usr.diff
are responsible.
40 + if (!getDriver().SysRoot.empty()) { 41 + // Second add the generic one.42 + addSystemInclude(DriverArgs, CC1Args, LibPath + "/c++/" + Version);
43 + // Third the backward one.44 + addSystemInclude(DriverArgs, CC1Args, LibPath + "/c++/" + Version + "/backward");
45 + }The above lines are adding c++ include paths in the method (WebAssembly::AddClangSystemIncludeArgs)
for adding only system/c include paths. I think the c++ include paths should only be added in the methods for addinglibc++ (WebAssembly::addLibCxxIncludePaths) or libstdc++ (WebAssembly::addLibStdCXXIncludePaths) include
paths.Some context on why I need this fixed. I'm updating emscripten in Debian and need to provide pre-compiled libraries to the end user. However, when compiling c files in compiler-rt that include stdatomic.h, an issue arises. The system's stdatomic.h file uses an include_next to select any other stdatomic.h it finds in the include paths, and since there's another stdatomic.h [1] in the c++ include path of the emscripten sysroot, it gets selected. Ideally, the other stdatomic.h shouldn't be seen, but when compiling c files, clang-17 wrongly adds the c++ include directory from
the emscripten sysroot to the include paths which causes the conflict.1. https://github.com/emscripten-core/emscripten/blob/main/system/lib/libcxx/include/stdatomic.h
OpenPGP_0x3679ECB87B7CEC0C.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature