From fd4eed117dbbb743949bcda8acef6de1340747da Mon Sep 17 00:00:00 2001 From: Kevin Manalo Date: Fri, 23 Aug 2019 20:16:09 -0400 Subject: [PATCH] ESMF & NCL packages: Bug fixes for Intel Compilers (#11923) * esmf: add patch when building with intel for 7.0.x * esmf: set Makefile variables required to propagate CXX/F90 flags * ncl: add ymake patch for @6.4.0: * ncl: add pixman, bzip2, freetype dependencies --- .../repos/builtin/packages/esmf/intel.patch | 17 +++++++++++++++++ .../repos/builtin/packages/esmf/package.py | 15 +++++++++++++++ var/spack/repos/builtin/packages/ncl/package.py | 17 +++++++++++------ .../repos/builtin/packages/ncl/ymake.patch | 16 ++++++++++++++++ 4 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 var/spack/repos/builtin/packages/esmf/intel.patch create mode 100644 var/spack/repos/builtin/packages/ncl/ymake.patch diff --git a/var/spack/repos/builtin/packages/esmf/intel.patch b/var/spack/repos/builtin/packages/esmf/intel.patch new file mode 100644 index 0000000000..ab955d8c52 --- /dev/null +++ b/var/spack/repos/builtin/packages/esmf/intel.patch @@ -0,0 +1,17 @@ +--- old/build_config/Linux.intel.default/build_rules.mk 2019-06-27 15:55:30.857527494 -0400 ++++ new/build_config/Linux.intel.default/build_rules.mk 2019-06-27 15:56:13.007089627 -0400 +@@ -187,10 +187,10 @@ + ############################################################ + # OpenMP compiler and linker flags + # +-ESMF_OPENMP_F90COMPILEOPTS += -openmp +-ESMF_OPENMP_CXXCOMPILEOPTS += -openmp +-ESMF_OPENMP_F90LINKOPTS += -openmp +-ESMF_OPENMP_CXXLINKOPTS += -openmp ++ESMF_OPENMP_F90COMPILEOPTS += -qopenmp ++ESMF_OPENMP_CXXCOMPILEOPTS += -qopenmp ++ESMF_OPENMP_F90LINKOPTS += -qopenmp ++ESMF_OPENMP_CXXLINKOPTS += -qopenmp + + ############################################################ + # Set rpath syntax diff --git a/var/spack/repos/builtin/packages/esmf/package.py b/var/spack/repos/builtin/packages/esmf/package.py index a838f7c0f5..40819ade05 100644 --- a/var/spack/repos/builtin/packages/esmf/package.py +++ b/var/spack/repos/builtin/packages/esmf/package.py @@ -43,6 +43,8 @@ class Esmf(MakefilePackage): # Testing dependencies depends_on('perl', type='test') + # Make esmf build with newer intel versions + patch('intel.patch', when='@:7.0.99 %intel@17:') # Make esmf build with newer gcc versions # https://sourceforge.net/p/esmf/esmf/ci/3706bf758012daebadef83d6575c477aeff9c89b/ patch('gcc.patch', when='@:7.0.99 %gcc@6:') @@ -96,6 +98,19 @@ def edit(self, spec, prefix): os.environ['ESMF_INSTALL_LIBDIR'] = 'lib' os.environ['ESMF_INSTALL_MODDIR'] = 'include' + # Allow compiler flags to carry through from compiler spec + os.environ['ESMF_CXXCOMPILEOPTS'] = \ + ' '.join(spec.compiler_flags['cxxflags']) + os.environ['ESMF_F90COMPILEOPTS'] = \ + ' '.join(spec.compiler_flags['fflags']) + # ESMF will simply not build with Intel using backing GCC 8, in that + # case you need to point to something older, below is commented but is + # an example + # os.environ['ESMF_CXXCOMPILEOPTS'] = \ + # '-O2 -std=c++11 -gcc-name=/usr/bin/gcc' + # os.environ['ESMF_F90COMPILEOPTS'] = \ + # '-O2 -gcc-name=/usr/bin/gcc' + ############ # Compiler # ############ diff --git a/var/spack/repos/builtin/packages/ncl/package.py b/var/spack/repos/builtin/packages/ncl/package.py index aa4499c1c6..bbf84b8cd0 100644 --- a/var/spack/repos/builtin/packages/ncl/package.py +++ b/var/spack/repos/builtin/packages/ncl/package.py @@ -28,6 +28,8 @@ class Ncl(Package): patch('hdf5.patch', when="@6.4.0") # ymake-filter's buffer may overflow (upstream as of 6.5.0) patch('ymake-filter.patch', when="@6.4.0") + # ymake additional local library and includes will be filtered improperly + patch('ymake.patch', when="@6.4.0:") # This installation script is implemented according to this manual: # http://www.ncl.ucar.edu/Download/build_from_src.shtml @@ -59,6 +61,9 @@ class Ncl(Package): depends_on('libx11') depends_on('libxaw') depends_on('libxmu') + depends_on('pixman') + depends_on('bzip2') + depends_on('freetype') # In Spack, we do not have an option to compile netcdf without netcdf-4 # support, so we will tell the ncl configuration script that we want @@ -171,9 +176,9 @@ def prepare_install_config(self): # Build NCL? 'y\n', # Parent installation directory : - '\'' + self.spec.prefix + '\'\n', + self.spec.prefix + '\n', # System temp space directory : - '\'' + tempfile.gettempdir() + '\'\n', + tempfile.gettempdir() + '\n', # Build NetCDF4 feature support (optional)? 'y\n' ] @@ -219,12 +224,12 @@ def prepare_install_config(self): # Build GRIB2 support (optional) into NCL? 'n\n', # Enter local library search path(s) : - # The paths will be passed by the Spack wrapper. - ' \n', + self.spec['pixman'].prefix.lib + ' ' + + self.spec['bzip2'].prefix.lib + '\n', # Enter local include search path(s) : # All other paths will be passed by the Spack wrapper. - '\'' + join_path(self.spec['freetype'].prefix.include, - 'freetype2') + '\'\n', + join_path(self.spec['freetype'].prefix.include, 'freetype2') + + '\n', # Go back and make more changes or review? 'n\n', # Save current configuration? diff --git a/var/spack/repos/builtin/packages/ncl/ymake.patch b/var/spack/repos/builtin/packages/ncl/ymake.patch new file mode 100644 index 0000000000..d989351b23 --- /dev/null +++ b/var/spack/repos/builtin/packages/ncl/ymake.patch @@ -0,0 +1,16 @@ +diff --git a/config/ymake b/config/ymake +index 7b785bc..ca24dba 100755 +--- a/config/ymake ++++ b/config/ymake +@@ -649,6 +649,11 @@ case UNICOS: + set cppopt = -N + breaksw + case Linux: ++ set cppopt = -traditional-cpp ++ # because local libraries and includes will otherwise have this prefix ++ # '1-rhel7-1' instead of 'linux-rhel7-x86_64' ++ set defines = "$defines -Dlinux=linux -Dx86_64=x86_64" ++ breaksw + case FreeBSD: + case CYGWIN: + set cppopt = -traditional-cpp