From 5e9c702fa7af45fd3b0724e0f0622845ac7c893c Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 8 May 2024 20:45:04 +0200 Subject: [PATCH] gcc: use -idirafter for libc headers (#44081) GCC C++ headers like cstdlib use `#include_next ` 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. --- var/spack/repos/builtin/packages/gcc/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index b3bb491d7f..2633207113 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -1172,7 +1172,7 @@ def _post_buildcache_install_hook(self): os.path.exists(os.path.join(header_dir, h)) for h in libc.package_class.representative_headers ): - relocation_args.append(f"-isystem {header_dir}") + relocation_args.append(f"-idirafter {header_dir}") else: tty.warn( f"Cannot relocate {specs_file} include directories, "