summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2022-04-16 21:12:03 +0200
committerGitHub <noreply@github.com>2022-04-16 21:12:03 +0200
commitb0c8affbd943b6d86bf650ceab7faa16eacaddcb (patch)
treef94c889437c265256760dd2b5216cb54368c5d6e
parent03a7643816a17096beb8ba4939e78a22bd372390 (diff)
downloadspack-b0c8affbd943b6d86bf650ceab7faa16eacaddcb.tar.gz
spack-b0c8affbd943b6d86bf650ceab7faa16eacaddcb.tar.bz2
spack-b0c8affbd943b6d86bf650ceab7faa16eacaddcb.tar.xz
spack-b0c8affbd943b6d86bf650ceab7faa16eacaddcb.zip
gcc: avoid excessive stat calls (#30005)
For about a decade GCC has an option `-f[no]-canonical-system-headers` which basically runs `realpath` on all "system headers", to possibly reduce the length of paths in diagnostics. [1] Spack usually installs the "system headers" of GCC in very deeply nested directories. Calling `realpath` there results in stat calls on every level, for every header file. On some slow filesystem I have, `-fno-canonical-system-headers` gives about 5x speedup to compile hello world in C, meaning that ./configure scripts would be much faster when using this flag by default. [1] https://codereview.appspot.com/6495088
-rw-r--r--var/spack/repos/builtin/packages/gcc/package.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py
index 04c0e31ac0..cf3765fb31 100644
--- a/var/spack/repos/builtin/packages/gcc/package.py
+++ b/var/spack/repos/builtin/packages/gcc/package.py
@@ -523,6 +523,11 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
'--disable-nls'
]
+ # Avoid excessive realpath/stat calls for every system header
+ # by making -fno-canonical-system-headers the default.
+ if self.version >= Version('4.8.0'):
+ options.append('--disable-canonical-system-headers')
+
# Use installed libz
if self.version >= Version('6'):
options.append('--with-system-zlib')