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

cc.has_header('linux/foo.h') does not work with gcc #1458

Closed
tp-m opened this issue Mar 11, 2017 · 3 comments
Closed

cc.has_header('linux/foo.h') does not work with gcc #1458

tp-m opened this issue Mar 11, 2017 · 3 comments

Comments

@tp-m
Copy link
Member

tp-m commented Mar 11, 2017

Meson checks for the existance of headers with something like (simplified):

#ifdef __has_include
 #if !__has_include(<linux/memfd.h>)
  #error "Header 'linux/memfd.h' could not be found"
 #endif
#endif

Problem is, that (unlike clang) current gcc/cpp versions expand the linux part here because #define linux , so they look for the header 1/memfd.h and don't find it.

This is a gcc/cpp bug of course, but it stands to reason that knowing about this limitation with current version of gcc on Linux Meson should not check for the existance of headers differently in these cases, or work around it, e.g. by doing #undef linux (which will not fully work around the general issue of course, just one of the most common occurances).

@jpakkane
Copy link
Member

Let's see what GCC devs say. This is serious enough that it might even make it into a distro patch.

@nirbheek
Copy link
Member

Using the __has_include("linux/memfd.h") form doesn't trigger this bug, so maybe we could use that instead. The downside is that it will find that header if it's relative to the current directory and those listed with -iquote too.

Maybe we could use that form only with specific GCC versions that we know are buggy (which is all GCC versions right now).

@nirbheek
Copy link
Member

Actually, it doesn't matter if we use the <> or "" form because our compiler checks are run from a temporary directory anyway. It cannot find any headers in the source or builddir. Will open a PR to fix this.

jpakkane pushed a commit that referenced this issue Mar 12, 2017
This is broken on GCC due to a GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80005

It doesn't matter whether we use <> or "" in our checks because we run
them from an empty temporary directory anyway.

Includes a test for all this.

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

No branches or pull requests

3 participants