From 35d81a9006a5fa32a012a40874ac6cbdefd4a259 Mon Sep 17 00:00:00 2001 From: andymwood Date: Tue, 5 Jan 2021 21:11:29 +0000 Subject: VTK: add -no-ipo for builds using intel compiler (#20480) Co-authored-by: Adam J. Stewart --- var/spack/repos/builtin/packages/vtk/package.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py index 834a96b7ab..d7a7126830 100644 --- a/var/spack/repos/builtin/packages/vtk/package.py +++ b/var/spack/repos/builtin/packages/vtk/package.py @@ -265,11 +265,10 @@ class Vtk(CMakePackage): '-DVTK_USE_X:BOOL=ON', '-DVTK_USE_COCOA:BOOL=OFF']) + compile_flags = [] + if spec.satisfies('@:6.1.0'): - cmake_args.extend([ - '-DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY', - '-DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY' - ]) + compile_flags.append('-DGLX_GLXEXT_LEGACY') # VTK 6.1.0 (and possibly earlier) does not use # NETCDF_CXX_ROOT to detect NetCDF C++ bindings, so @@ -298,4 +297,16 @@ class Vtk(CMakePackage): cmake_args.append( '-DVTK_MODULE_ENABLE_VTK_IOMotionFX:BOOL=OFF') + # -no-ipo prevents an internal compiler error from multi-file + # optimization (https://github.com/spack/spack/issues/20471) + if '%intel' in spec: + compile_flags.append('-no-ipo') + + if compile_flags: + compile_flags = ' '.join(compile_flags) + cmake_args.extend([ + '-DCMAKE_C_FLAGS={0}'.format(compile_flags), + '-DCMAKE_CXX_FLAGS={0}'.format(compile_flags) + ]) + return cmake_args -- cgit v1.2.3-70-g09d2