diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index d7d9dcc14d7..f6dce2ea00d 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -1016,7 +1016,9 @@ def setup_run_environment(self, env): continue abspath = os.path.join(bin_path, filename) - if os.path.islink(abspath): + + # Skip broken symlinks (https://github.com/spack/spack/issues/41327) + if not os.path.exists(abspath): continue # Set the proper environment variable