gcc: use -idirafter for libc headers (#44081)

GCC C++ headers like cstdlib use `#include_next <stdlib.h>` to wrap libc
headers. We're using `-isystem` for libc, which puts those headers too
early in the search path. `-idirafter` fixes this so `include_next`
works.
This commit is contained in:
Harmen Stoppels 2024-05-08 20:45:04 +02:00 committed by GitHub
parent 314893982e
commit e1686eef7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1174,7 +1174,7 @@ def _post_buildcache_install_hook(self):
os.path.exists(os.path.join(header_dir, h)) os.path.exists(os.path.join(header_dir, h))
for h in libc.package_class.representative_headers for h in libc.package_class.representative_headers
): ):
relocation_args.append(f"-isystem {header_dir}") relocation_args.append(f"-idirafter {header_dir}")
else: else:
tty.warn( tty.warn(
f"Cannot relocate {specs_file} include directories, " f"Cannot relocate {specs_file} include directories, "