From c3cc4eaa9945a11b570a6f412ba8e51e6dd3ed34 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Wed, 22 May 2024 11:31:17 +0200 Subject: [PATCH] gcc: Only create and sanity-check symlinks for actualy built languages Closes #3316 --- easybuild/easyblocks/g/gcc.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/easybuild/easyblocks/g/gcc.py b/easybuild/easyblocks/g/gcc.py index 025a4c44e8..afa08b4e2e 100644 --- a/easybuild/easyblocks/g/gcc.py +++ b/easybuild/easyblocks/g/gcc.py @@ -68,10 +68,12 @@ DEFAULT_LANGUAGES = ['c', 'c++', 'fortran'] # Additional symlinks to create for compiler commands COMP_CMD_SYMLINKS = { - 'cc': 'gcc', - 'c++': 'g++', - 'f77': 'gfortran', - 'f95': 'gfortran', + 'c': { 'cc': 'gcc' }, + 'c++': { 'c++': 'g++' }, + 'fortran': { + 'f77': 'gfortran', + 'f95': 'gfortran', + } } RECREATE_INCLUDE_FIXED_SCRIPT_TMPL = """#!/bin/bash @@ -907,8 +909,8 @@ def post_install_step(self, *args, **kwargs): # Add symlinks for cc/c++/f77/f95. bindir = os.path.join(self.installdir, 'bin') - for key in COMP_CMD_SYMLINKS: - src = COMP_CMD_SYMLINKS[key] + languages = self.cfg['languages'] or DEFAULT_LANGUAGES + for key, src in [x for l in languages & COMP_CMD_SYMLINKS.keys() for x in COMP_CMD_SYMLINKS[l].items()]: target = os.path.join(bindir, key) if os.path.exists(target): self.log.info("'%s' already exists in %s, not replacing it with symlink to '%s'", @@ -1103,7 +1105,7 @@ def sanity_check_step(self): common_infix = os.path.join('gcc', config_name_subdir, self.version) libexec_files = [tuple([os.path.join(d, common_infix, x) for d in libdirs]) for x in libexec_files] - old_cmds = [os.path.join('bin', x) for x in COMP_CMD_SYMLINKS.keys()] + old_cmds = [os.path.join('bin', x) for l in languages & COMP_CMD_SYMLINKS.keys() for x in COMP_CMD_SYMLINKS[l]] custom_paths = { 'files': bin_files + lib_files + libexec_files + old_cmds,