Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
EFanZh opened this issue Aug 13, 2016 · 5 comments
Closed

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

EFanZh opened this issue Aug 13, 2016 · 5 comments
Milestone

Comments

@EFanZh
Copy link

EFanZh commented Aug 13, 2016

I got an error when checking this file:

#include <iostream>

int main()
{
    std::cout << "Hi!\n";
}

My include-what-you-use is installed in /usr/bin. The command line I use is:

include-what-you-use a.cpp

The output is:

In file included from a.cpp:1:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/iostream:39:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/ostream:38:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/ios:38:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/iosfwd:40:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/postypes.h:40:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/cwchar:44:
/usr/include/wchar.h:39:11: fatal error: 'stdarg.h' file not found
# include <stdarg.h>
          ^

a.cpp should add these lines:

a.cpp should remove these lines:
- #include <iostream>  // lines 1-1

The full include-list for a.cpp:

---

According to README.md, my clang is installed in /usr/bin, so there should be a stdarg.h in /usr/lib/clang/3.8.1/include, and I checked, there is a stdarg.h in that directory. So what is wrong?

Environment:

  • OS: Arch Linux x86_x64
  • clang: 3.8.1
  • gcc: 6.1.1
  • include-what-you-use (from AUR): 0.6
@kimgr
Copy link
Contributor

kimgr commented Aug 13, 2016

That is surprising. Can you run IWYU like this to get more info on the effective search paths?

$ include-what-you-use -v -Xiwyu -v6 a.cpp

The only thing I can think of that might be the problem is that IWYU 0.6 might've been built against clang 3.8.0, not 3.8.1, but I'm not sure. The command above should dump the relevant version too.

@EFanZh
Copy link
Author

EFanZh commented Aug 15, 2016

You are right, my IWYU is built against clang 3.8.0. After a system upgrade, my clang is upgraded but I did not rebuild the IWYU, hence the problem. After rebuilding IWYU, everything seems fine now. You can close this issue now, thanks.

@kimgr
Copy link
Contributor

kimgr commented Aug 15, 2016

OK, thanks!

@sylvestre
Copy link
Contributor

Maybe iwyu should look for the paths dynamically and not at build time

@kimgr
Copy link
Contributor

kimgr commented Dec 26, 2016

@sylvestre -- did you have a particular strategy in mind? Scanning the filesystem for whatever latest Clang headers exist? I don't know too much about the builtin headers, but I suspect that they're quite intimately tied to Clang/LLVM internals. Maybe that's an ungrounded concern?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants