When building against a sysroot, meson currently fails to detect that the /usr/include directory within that sysroot is a default search directory. This causes the directory to be added with -isystem to the compiler command-line which in turn causes include lookup failures. A minimal test case to reproduce this behaviour is: $ echo -e "#include <iostream>\nint main() { return 0; }" > foo.cpp $ g++ --sysroot / -isystem /usr/include -o foo foo.cpp In file included from /usr/include/c++/11.1.0/ext/string_conversions.h:41, from /usr/include/c++/11.1.0/bits/basic_string.h:6594, from /usr/include/c++/11.1.0/string:55, from /usr/include/c++/11.1.0/bits/locale_classes.h:40, from /usr/include/c++/11.1.0/bits/ios_base.h:41, from /usr/include/c++/11.1.0/ios:42, from /usr/include/c++/11.1.0/ostream:38, from /usr/include/c++/11.1.0/iostream:39, from foo.cpp:1: /usr/include/c++/11.1.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory 75 | #include_next <stdlib.h> | ^~~~~~~~~~ compilation terminated. Omitting the -isystem /usr/include option avoids that error because it doesn't mess up the include directory search order. Fix this by adding the sysroot's /usr/include directory to the list of default search directories when a sysroot is detected. This ensures that any occurrences of it are filtered out and the include directory search order is left alone.pull/9993/head
parent
9e4feed91a
commit
291dbef659
1 changed files with 18 additions and 0 deletions
Loading…
Reference in new issue