From b70bf073b5f647dd5a7f1917ed55dfd39d1a2a0c Mon Sep 17 00:00:00 2001 From: Frank Willmore Date: Thu, 13 May 2021 23:31:20 -0500 Subject: cc: change mode to ccld for loopopt edit (#23482) For configure (e.g. for hdf5) to pass, this option needs to be pulled out when invoked in ccld mode. I thought it had fixed the issue but I still saw it after that. After some digging, my guess is that I was able to get hdf5 to build with ifort instead of ifx. Lot of overlapping changes occurring at the time, as it were. There are still outstanding issues building hdf5 with ifx, and Intel is looking into what appears to be a compiler bug, but this manifests during build and is likely a separate issue. I have verified that the making the edit in 'ccld' mode removes the -loopopt=0 and enables hdf5 to pass configure. It should be fine to make the edit in 'ld' mode as well, but I have not tested that and didn't include an -or- condition for it. --- lib/spack/env/cc | 8 +++++--- lib/spack/spack/test/cc.py | 9 ++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/spack/env/cc b/lib/spack/env/cc index 4d8c4644cb..bd479f05ec 100755 --- a/lib/spack/env/cc +++ b/lib/spack/env/cc @@ -319,11 +319,13 @@ while [ $# -ne 0 ]; do fi ;; -l*) - # -loopopt=0 is passed to the linker erroneously in - # autoconf <= 2.69. Filter it out. + # -loopopt=0 is generated erroneously in autoconf <= 2.69, + # and passed by ifx to the linker, which confuses it with a + # library. Filter it out. # TODO: generalize filtering of args with an env var, so that # TODO: we do not have to special case this here. - if [ "$mode" = "ld" ] && [ "$1" != "${1#-loopopt}" ]; then + if { [ "$mode" = "ccld" ] || [ $mode = "ld" ]; } \ + && [ "$1" != "${1#-loopopt}" ]; then shift continue fi diff --git a/lib/spack/spack/test/cc.py b/lib/spack/spack/test/cc.py index fa61a5e9e6..20ec946835 100644 --- a/lib/spack/spack/test/cc.py +++ b/lib/spack/spack/test/cc.py @@ -632,7 +632,14 @@ def test_linker_strips_loopopt(wrapper_flags): result = result.strip().split('\n') assert '-loopopt=0' not in result - # ensure that -loopopt=0 is present in compile mode + # ensure that -loopopt=0 is not present in ccld mode result = cc(*(test_args + ["-loopopt=0"]), output=str) result = result.strip().split('\n') + assert '-loopopt=0' not in result + + # ensure that -loopopt=0 *is* present in cc mode + # The "-c" argument is needed for cc to be detected + # as compile only (cc) mode. + result = cc(*(test_args + ["-loopopt=0", "-c", "x.c"]), output=str) + result = result.strip().split('\n') assert '-loopopt=0' in result -- cgit v1.2.3-60-g2f50