<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/91227>91227</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Webassembly doesn't look for libc++ relative to clang, only under sysroot
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JonChesterfield
</td>
</tr>
</table>
<pre>
ToolChains/WebAssembly.cpp addLibCxxIncludePaths calls detectLibcxxVersion on computeSysRoot()/include. If there's a c++/v. directory there, it adds system include paths for sysroot/include/triple/cxx/v and sysroot/include/cxx/v
GenericGCC and things derived from it (I found this for Linux) does more complicated things. It looks in various places for a plausible include path and when it finds one (or sometimes two) it stops looking for alternatives.
First try getDriver().Dir/../include/triple/c++/v and getDriver().Dir/../include/c++/v
Then try sysroot/usr/local/include
Then try sysroot/usr/include
Webassembly uses `libpath / MultiArchTriple / cxx` directly, Generic_GCC checks whether the directory exists as well. That's a behaviour difference but probably not a significant one - changing to not looking in a directory that doesn't exist seems OK to me.
I'd like to use the same set of libc++ headers for webassembly as for other targets but the workaround of copying them doesn't do much harm.
Creating this issue to ask:
1. Should webassembly look for libc++ at clang/../include/cxx/?
2. Should it adopt the getTargetSubDirPath pattern of not appending non-existing dirs?
3. If next to clang and sysroot both exist, do we want to explictly ignore one of them
The change is straightforward if we want it. Thanks
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVd1u4zYTfRr6ZhBBoS3_XPgi68CLfN8WLbpG97KgyJHEmiIFcuSfty-GchIb2BYFAseWZobnzDkzVCnZ1iNuRfVFVK8zNVIX4vZ_we86TISxsejMrA7muj2E4Hadsj4Juf-B9UtK2NfuWuhhAGXMN1vvLpc3r91o8DdFXQKtnEtgkFDTN1vry-UPjMkGD8GDDv0wEn6_pt9DICHXQm6E3NupQAFvDVCHEYVcJVCghfyS__anAoyNqCnE63vIDiwxiAT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