yrnkrn / zapcc

zapcc is a caching C++ compiler based on clang, designed to perform faster compilations
Other
1.25k stars 61 forks source link

Zapcc not able to compile due to not finding stddef.h while Clang compiles fine. #39

Open SeanRamey opened 4 years ago

SeanRamey commented 4 years ago

I am getting an error that zapcc can't find stddef.h? I have no clue as to what could be happening. Clang compiles perfectly.

`1 error generated. generating dependencies for src/main.cpp In file included from src/main.cpp:1: In file included from src/sfmlpch.hpp:4: In file included from /usr/include/SFML/System.hpp:34: In file included from /usr/include/SFML/System/Err.hpp:32: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/ostream:38: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/ios:38: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/iosfwd:40: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/bits/postypes.h:40: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/cwchar:44: /usr/include/wchar.h:35:10: fatal error: 'stddef.h' file not found

include

     ^~~~~~~~~~`

`1 error generated. generating dependencies for src/game.cpp In file included from src/game.cpp:1: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/iostream:39: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/ostream:38: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/ios:38: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/iosfwd:40: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/bits/postypes.h:40: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/cwchar:44: /usr/include/wchar.h:35:10: fatal error: 'stddef.h' file not found

include

     ^~~~~~~~~~`

`1 error generated. generating dependencies for src/resources.cpp In file included from src/resources.cpp:1: In file included from src/stdpch.hpp:4: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/iostream:39: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/ostream:38: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/ios:38: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/iosfwd:40: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/bits/postypes.h:40: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/cwchar:44: /usr/include/wchar.h:35:10: fatal error: 'stddef.h' file not found

include `

yrnkrn commented 4 years ago

zapcc had not been updated for quite a while, maybe the include paths are not correct for gcc 9.2.

hamoid commented 4 years ago

@yrnkrn Will that change in the future? Is it easy to update those include paths?

yrnkrn commented 4 years ago

Yes, cherry picking just the relevant source lines for these include paths should be easy.

dimitre commented 4 years ago

I'm having issues here too, zapcc doesnt find the file I need which is

xcrun clang -c -M -xc - <<<'# include <TargetConditionals.h>'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/TargetConditionals.h

any tips of how to make this work without recompile zapcc ? something like symlinks or maybe make additional folders?

and here the different paths for clang & zapcc

echo | clang++ -E -Wp,-v -
clang -cc1 version 11.0.0 (clang-1100.0.33.17) default target x86_64-apple-darwin18.7.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 362 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
echo | zapcc++ -E -Wp,-v -
clang -cc1 version 7.0.0 based upon LLVM 7.0.0svn default target x86_64-apple-darwin18.7.0
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Volumes/tool/_src/llvm/build/lib/clang/7.0.0/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 361 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
yrnkrn commented 4 years ago

Maybe add the missing includes using -I flag.