lcompilers / lc

C++ compiler
MIT License
26 stars 7 forks source link

fatal error: 'stdarg.h' file not found #31

Open certik opened 9 months ago

certik commented 9 months ago

I created a new lc environment and built it using the README.

I am getting the following error on macOS:

$ ./src/bin/lc integration_tests/array_09.cpp
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "integration_tests/array_09.cpp"
No compilation database found in /Users/ondrej/repos/lcompilers/lc/integration_tests or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
In file included from /Users/ondrej/repos/lcompilers/lc/integration_tests/array_09.cpp:1:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:37:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/ios:214:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/iosfwd:95:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/wchar.h:119:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/wchar.h:89:10: fatal error: 'stdarg.h' file not found
#include <stdarg.h>
         ^~~~~~~~~~
LCOMPILERS_ASSERT failed: /Users/ondrej/repos/lcompilers/lc/src/libasr/../libasr/asr.h
function down_cast(), line number 40 at 
f != nullptr
zsh: abort      ./src/bin/lc integration_tests/array_09.cpp
czgdp1807 commented 9 months ago

I will try to share the zshrc configurations tomorrow morning. Its picking the wrong set of headers. That’s all. Path related issue.

czgdp1807 commented 9 months ago

Oh I see.

czgdp1807 commented 9 months ago

Use the installed lc and not the one from src/bin/lc. Installed one goes to CONDA_PREFIX/bin. Add it to PATH and everything should work fine. These are all path related issues. Also, pass, -I$CONDA_PREFIX/include in —extra-arg.

certik commented 9 months ago

I see. When you install it, it works!

lc integration_tests/array_09.cpp

That means one must always install using "make install", until we fix all these path issues (here is another one: https://github.com/lcompilers/lc/issues/32).