easybuilders / easybuild-easyblocks

Collection of easyblocks that implement support for building and installing software with EasyBuild.
https://easybuild.io
GNU General Public License v2.0
103 stars 279 forks source link

RPATH issue with cdft wrappers when using OneAPI compilers #2910

Open bedroge opened 1 year ago

bedroge commented 1 year ago

While installing imkl-FFTW/2022.2.1-iimpi-2022b with --rpath, I ran into lots of the following errors:

mpiicc -c  -Wall -Werror -std=c99 -Wall -Werror -std=c99    \
         -DMKL_DOUBLE -I../../include -I../../include/fftw wrappers/1d_create_plan.c -o /dev/shm/f115372/imklFFTW/2022.2.1/iimpi-2022b/tmp0j8l_1wg/obj_DOUBLE_intel64_lp64/1d_create_plan.o
icx: error: -Wl,-rpath=/cvmfs/hpc.rug.nl/versions/2023.01/rocky8/x86_64/amd/zen3/software/imkl-FFTW/2022.2.1-iimpi-2022b/lib: 'linker' input unused [-Werror,-Wunused-co
mmand-line-argument]
icx: error: -Wl,-rpath=/cvmfs/hpc.rug.nl/versions/2023.01/rocky8/x86_64/amd/zen3/software/imkl-FFTW/2022.2.1-iimpi-2022b/lib64: 'linker' input unused [-Werror,-Wunused-
command-line-argument]
icx: error: -Wl,-rpath=$ORIGIN: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=$ORIGIN/../lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=$ORIGIN/../lib64: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,--disable-new-dtags: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=/cvmfs/hpc.rug.nl/versions/2023.01/rocky8/x86_64/amd/zen3/software/imkl/2022.2.1/mkl/2022.2.1/lib/intel64: 'linker' input unused [-Werror,-Wunuse
d-command-line-argument]
icx: error: -Wl,-rpath=/cvmfs/hpc.rug.nl/versions/2023.01/rocky8/x86_64/amd/zen3/software/imkl/2022.2.1/compiler/2022.2.1/linux/compiler/lib/intel64_lin: 'linker' input
 unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=/cvmfs/hpc.rug.nl/versions/2023.01/rocky8/x86_64/amd/zen3/software/impi/2021.7.1-intel-compilers-2022.2.1/mpi/2021.7.1/libfabric/lib: 'linker' in

This looks very much like the issue that @casparvl reported (https://github.com/easybuilders/easybuild-easyblocks/pull/2799#issuecomment-1270621100) and solved (see https://github.com/easybuilders/easybuild-easyblocks/pull/2799/files#diff-093bbadabc20f96a7fa30c5dbca192bdd752e4be7c9b9f21679b9b701348a865R433) for Clang , so I guess we need to do the same thing for newer versions of the Intel compilers (aren't these using Clang now as well?).

bedroge commented 1 year ago

I don't know how broad the issue is (i.e. which applications set -Wall -Werror besides this one), but for imkl-FFTW it could be easily solved by adjusting the imkl easyblock (similar to what is done for PGI/NVHPC here: https://github.com/easybuilders/easybuild-easyblocks/blob/develop/easybuild/easyblocks/i/imkl.py#L217) and making sure that these options are removed from the makefile for newer Intel compilers.

bedroge commented 1 year ago

A somewhat cleaner solution, the following regex for just adding -Wno-unused-command-line-argument to the makefiles seems to work fine too:

regex_subs = [('-Werror', '-Werror -Wno-unused-command-line-argument')]
bedroge commented 1 year ago

I've now tried the following, and this also seems to work fine:

        if get_software_root('intel-compilers') and build_option('rpath'):
            intelver = get_software_version('intel-compilers')
            if LooseVersion(intelver) >= LooseVersion("2022.2.0"):
                regex_icx_subs = [('-Werror', '-Werror -Wno-unused-command-line-argument')]
                for lib in self.cdftlibs:
                    apply_regex_substitutions(os.path.join(interfacedir, lib, 'makefile'), regex_icx_subs)
casparvl commented 1 year ago

Looks sensible to me. It should be specific to rpath, since the RPATH wrappers of EasyBuild then add Wl,-rpath arguments, which are not used when only compiling - which is what the compiler then complains about.

Regarding

if LooseVersion(intelver) >= LooseVersion("2022.2.0"):

If I understand correctly, you only see this error when using the new OneAPI (i.e. DPC) compilers, since those are based on Clang. Maybe instead of a version check, we can check if the OneAPI compilers are used (at least as c/c++ compilers)? Should probably use something like this and this. The advantage here is that if the OneAPI compilers are used by an older version of the toolchain, your fix would still be applied :)

bedroge commented 1 year ago

@casparvl You're absolutely right, that check is much better, especially since you can disable the use of the new compilers with new versions. I'll change that and make a PR.

bedroge commented 1 year ago

Created a pull request: https://github.com/easybuilders/easybuild-easyblocks/pull/2912