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

Python Clang Bindings don't find standard headers on Fedora #193

Closed
jnikula opened this issue Oct 9, 2023 · 0 comments · Fixed by #194
Closed

Python Clang Bindings don't find standard headers on Fedora #193

jnikula opened this issue Oct 9, 2023 · 0 comments · Fixed by #194
Labels
bug parser Related to the Clang glue layer

Comments

@jnikula
Copy link
Owner

jnikula commented Oct 9, 2023

Recently, we added #include <stdbool.h> to a number of tests. It works fine on various versions of Debian.

However, on Fedora, it's not found. At least not in the recently added Docker images. Run make docker-test.fedora-37 to reproduce.

Is something missing in the Dockerfiles? Some clang configuration different on Fedora? The header files can be found in /usr/lib64/clang/15.0.7/include/stdbool.h.

Running clang inside the container to figure out include paths gives:

$ cat /dev/null | clang -E -Wp,-v -
clang -cc1 version 15.0.7 based upon LLVM 15.0.7 default target x86_64-redhat-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../x86_64-redhat-linux/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib64/clang/15.0.7/include
 /usr/local/include
 /usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 370 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2

hawkmoth test/c/variable.c inside the container fails with CRITICAL: test/c/variable.c:1: 'stdbool.h' file not found.

Explicitly specifying the include path works: hawkmoth --clang=-I/usr/lib64/clang/15.0.7/include test/c/variable.c

But Debian does not require that.

@jnikula jnikula added the parser Related to the Clang glue layer label Oct 9, 2023
jnikula added a commit that referenced this issue Oct 9, 2023
Apparently libclang (and consequently Clang Python Bindings) does not
universally get its system include paths right by default, or the same
as clang. The defaults work on Debian, but not on Fedora, for example,
and I've been unable to root cause this.

Anyway, we already have a helper for querying the system include args
from clang, so use it.

Fixes #193.
jnikula added a commit that referenced this issue Oct 9, 2023
Apparently libclang (and consequently Clang Python Bindings) does not
universally get its system include paths right by default, or the same
as clang. The defaults work on Debian, but not on Fedora, for example,
and I've been unable to root cause this.

Anyway, we already have a helper for querying the system include args
from clang, so use it.

Update github workflow while at it, as the examples check now also needs
clang.

Fixes #193.
@jnikula jnikula added the bug label Oct 10, 2023
jnikula added a commit that referenced this issue Oct 12, 2023
Apparently libclang (and consequently Clang Python Bindings) does not
universally get its system include paths right by default, or the same
as clang. The defaults work on Debian, but not on Fedora, for example,
and I've been unable to root cause this.

Anyway, we already have a helper for querying the system include args
from clang, so use it.

Update github workflow while at it, as the examples check now also needs
clang.

Fixes #193.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug parser Related to the Clang glue layer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant