Skip to content

Commit a46df52

Browse files
authored
Merge pull request #3409 from boegel/ccache_gfortran
stop installing ccache wrapper for Fortran compiler
2 parents 687bcbb + ef86063 commit a46df52

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

easybuild/tools/toolchain/toolchain.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,11 @@ def comp_cache_compilers(self, cache_tool):
824824
c_comps, fortran_comps = self.compilers()
825825

826826
if cache_tool == CCACHE:
827-
# recent versions of ccache (>=3.3) also support caching of Fortran compilations
828-
comps = c_comps + fortran_comps
827+
# some version of ccache support caching of Fortran compilations,
828+
# but it doesn't work with Fortran modules (https://github.com/ccache/ccache/issues/342),
829+
# and support was dropped in recent ccache versions;
830+
# as a result, we only use ccache for C/C++ compilers
831+
comps = c_comps
829832
elif cache_tool == F90CACHE:
830833
comps = fortran_comps
831834
else:
@@ -838,6 +841,8 @@ def comp_cache_compilers(self, cache_tool):
838841
self.log.debug("Not caching compiler %s, it's already being cached", comp)
839842
comps.remove(comp)
840843

844+
self.log.info("Using %s for these compiler commands: %s", cache_tool, ', '.join(comps))
845+
841846
return comps
842847

843848
def prepare_compiler_cache(self, cache_tool):

test/framework/toolchain.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,9 +1433,17 @@ def test_compiler_cache(self):
14331433
self.assertTrue(regex.search(out), "Pattern '%s' found in: %s" % (regex.pattern, out))
14341434

14351435
# $CCACHE_DIR is defined by toolchain.prepare(), and should still be defined after running 'eb'
1436+
ccache_path = os.path.join(self.test_prefix, 'scripts', 'ccache')
14361437
self.assertTrue(os.path.samefile(os.environ['CCACHE_DIR'], ccache_dir))
1437-
for comp in ['gcc', 'g++', 'gfortran']:
1438-
self.assertTrue(os.path.samefile(which(comp), os.path.join(self.test_prefix, 'scripts', 'ccache')))
1438+
for comp in ['gcc', 'g++']:
1439+
comp_path = which(comp)
1440+
self.assertTrue(comp_path)
1441+
self.assertTrue(os.path.samefile(comp_path, ccache_path))
1442+
1443+
# no ccache wrapper for gfortran when using ccache
1444+
# (ccache either doesn't support Fortran anymore, or support is spotty (trouble with Fortran modules))
1445+
gfortran_path = which('gfortran')
1446+
self.assertTrue(gfortran_path is None or not os.path.samefile(gfortran_path, ccache_path))
14391447

14401448
# reset environment to get rid of ccache symlinks, but with ccache/f90cache mock scripts still in place
14411449
os.environ['PATH'] = prepped_path_envvar

0 commit comments

Comments
 (0)