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

Build fails on Arch Linux #186

Closed
mayjs opened this issue May 14, 2019 · 6 comments
Closed

Build fails on Arch Linux #186

mayjs opened this issue May 14, 2019 · 6 comments
Labels

Comments

@mayjs
Copy link

@mayjs mayjs commented May 14, 2019

The build of cppinsights fails on Arch Linux.
The error message is:

In file included from /usr/include/c++/8.3.0/ext/string_conversions.h:41,
                 from /usr/include/c++/8.3.0/bits/basic_string.h:6400,
                 from /usr/include/c++/8.3.0/string:52,
                 from /usr/include/c++/8.3.0/stdexcept:39,
                 from /usr/include/c++/8.3.0/array:39,
                 from /usr/include/c++/8.3.0/tuple:39,
                 from /usr/include/c++/8.3.0/bits/unique_ptr.h:37,
                 from /usr/include/c++/8.3.0/memory:80,
                 from /usr/include/llvm/Support/Casting.h:21,
                 from /usr/include/clang/Basic/LLVM.h:22,
                 from /usr/include/clang/AST/APValue.h:17,
                 from /usr/include/clang/AST/Decl.h:17,
                 from /usr/include/clang/AST/ASTTypeTraits.h:20,
                 from /usr/include/clang/AST/ASTContext.h:19,
                 from /usr/include/clang/AST/AST.h:18,
                 from ../Insights.cpp:8:
/usr/include/c++/8.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory

I've looked around a bit and found that this is somehow related to the -isystem/usr/include arguments that is used in the generated build.ninja file. Replacing all the -isystem parts with -I fixed the issue for me: sed -i "s/-isystem/-I/g" build.ninja, but this should be fixed in the CMake files somehow I think.

@andreasfertig
Copy link
Owner

@andreasfertig andreasfertig commented May 22, 2019

Hello @mayjs,

interesting and thanks for tracing it so far. Can you give more details about the build environment. Was it a out-of-clang build? What did CMake initially print out?

Andreas

@bstaletic
Copy link

@bstaletic bstaletic commented May 23, 2019

This is a problem with include path ordering. The order is:

  1. -isystem paths
  2. Implicit system include paths
  3. -I paths

This combined with the fact that /usr/include absolutely has to be the last of the system include paths can cause problems. What happens here is that specifying only -isystem/usr/include makes /usr/include come before all other implicit system include paths.

@bstaletic
Copy link

@bstaletic bstaletic commented May 23, 2019

A few more bits of information:

  • Include paths can be examined with clang++ -E -v.

  • The reason why the order matters is in the line right after what @mayjs posted:

    #include_next <stdlib.h>

With include paths reordered, #include_next from cstdlib is unable to find anything in /usr/include.

@andreasfertig
Copy link
Owner

@andreasfertig andreasfertig commented Jun 2, 2019

I do tamper a bit with the includes in CMakeLists.txt.

I'm not sure what a better solution might be.

@bstaletic
Copy link

@bstaletic bstaletic commented Jun 2, 2019

That line turns user defined include paths (-I) into system include paths (-isystem) which should be fine unless someone explicitly declared the implicit include paths as -I. And even then you'd be fine if all implicit paths got "transformed" (for lack of a better word). The problem would appear if only some of implicit include paths got turned explicit with -isystem.

@stale
Copy link

@stale stale bot commented Aug 1, 2019

Thanks for contributing to this issue. As it has been 60 days since the last activity waiting for a followup. This issue will be automatically closed in 7 days, if no further activity occurs. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please respond before the issue is closed. We'll gladly take a look again! In any case, thank you for your contributions!

@stale stale bot added the stale label Aug 1, 2019
@stale stale bot closed this Aug 8, 2019
andreasfertig added a commit that referenced this issue Sep 3, 2020
Fixed Issue #186: Build fails on Arch Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.