Repository navigation
Enable clang builtin include path - #8766
Conversation
| ] | ||
|
|
||
| c_opts = ['-nostdinc', '-Xclang', '-nobuiltininc', '-Xclang', '-nostdsysteminc'] | ||
| c_opts = ['-Xclang', '-nostdsysteminc'] |
There was a problem hiding this comment.
Hmm, I'm confused. Don't we need to disable the standard include dirs, so we can use our own stuff?
How are fastcomp and upstream different?
And what is nostdlib that is mentioned in the description, but I can't find in the codebase?
There was a problem hiding this comment.
I think we want to include the lib/clang/9.0.0/include or lib/clang/6.0.1/include that comes with compiler while excluding all the other system include paths (e.g. /usr/include/..
-nostdinc acts as a kind of superset of -nobuiltininc and -nostdsysteminc so what we had here was redundant I think.
I believe we do want the builtin compiler headers, but not the system headers.
I was wrote about fastcomp behaving differently, it seems like the behaviour is that same.
An alternative approach here would be to add stdatomic.h and any other headers that live in the compiler's include directory to emscripten.
There was a problem hiding this comment.
I see. Sounds reasonable, assuming those compiler headers work properly and don't override any of our own?
How do I find them? I don't seem to have /usr[/local]/include/clang*, and in the llvm repo I see clang/include/ contains the clang internals?
There was a problem hiding this comment.
These headers live in the lld and/or fastcomp install directories.
E.g.:
emsdk $ find -iname stdatomic.h
./upstream/5794/fastcomp/lib/clang/6.0.1/include/stdatomic.h
./upstream/5794/lib/clang/9.0.0/include/stdatomic.h
This pass is added at the very end of the include path, so they should act as a fallback for anything not found in musl.
e.g.: run emcc with -v to see the full include path:
nable-emscripten-sjlj -mllvm -disable-lsr -o test.o -x c test.c
clang -cc1 version 9.0.0 based upon LLVM 9.0.0svn default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include/wasm32-emscripten"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/google/home/sbc/dev/wasm/emscripten/system/include/libcxx
/usr/local/google/home/sbc/dev/wasm/emscripten/system/lib/libcxxabi/include
/usr/local/google/home/sbc/dev/wasm/emscripten/system/include/compat
/usr/local/google/home/sbc/dev/wasm/emscripten/system/include
/usr/local/google/home/sbc/dev/wasm/emscripten/system/include/libc
/usr/local/google/home/sbc/dev/wasm/emscripten/system/lib/libc/musl/arch/emscripten
/usr/local/google/home/sbc/dev/wasm/emscripten/system/local/include
/usr/local/google/home/sbc/dev/wasm/emscripten/system/include/SDL
/usr/local/google/home/sbc/dev/wasm/llvm-build/lib/clang/9.0.0/include
End of search list.
b86d45b to
1a2330c
Compare
1a2330c to
c469c16
Compare
The `-nostdlib` argument to clang was previously preventing the compiler specific include directory from being added, but this wasn't effecting fastcomp in the same way.
c469c16 to
f8a1873
Compare
…8766) The `-nostdlib` argument to clang was previously preventing the compiler specific include directory from being added, but this wasn't effecting fastcomp in the same way.
The
-nostdlibargument to clang was previously preventing thecompiler specific include directory from being added.