Cannot find WASI libc++ headers without normal libc++ headers installed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
llvm-toolchain-16 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
This bug concerns libc++-
The problem can be seen in the following series of steps, starting with a minimal system:
# apt-get install clang libc++-dev-wasm32
$ echo '#include <cstring>' >test.cpp
$ /usr/bin/clang++ --target=
tst.cpp:1:10: fatal error: 'cstring' file not found
#include <cstring>
1 error generated.
# apt-get install libc++-dev
$ /usr/bin/clang++ --target=
(success)
Note that Clang, with --target=
$ /usr/bin/clang++ --target=
. /usr/include/
.. /usr/include/
... /usr/include/
[...]
The headers provided by libc++-16-dev are extraneous to the requested compilation, so why is the compile affected by their absence/presence?
I encountered this issue in the course of attempting to build Firefox on the system. The following build log excerpt tells how this issue first arose:
[...]
checking the wasm C++ compiler works... yes
checking the wasm C++ compiler can find wasi headers...
DEBUG: Creating `/tmp/conftest.
DEBUG: | #include <cstring>
DEBUG: | int
DEBUG: | main(void)
DEBUG: | {
DEBUG: |
DEBUG: | ;
DEBUG: | return 0;
DEBUG: | }
DEBUG: Executing: `/usr/bin/clang++ --target=
DEBUG: The command returned non-zero exit status 1.
DEBUG: Its error output was:
DEBUG: | /tmp/conftest.
DEBUG: | #include <cstring>
DEBUG: | ^~~~~~~~~
DEBUG: | 1 error generated.
ERROR: Cannot find wasi headers or problem with the wasm compiler. Please fix the problem. Or build with --without-
make[1]: *** [debian/rules:235: stamps/
make[1]: Leaving directory '/home/
make: *** [debian/rules:341: build] Error 2
dpkg-