Trilinos: add linker flags to improve behavior (#29492)

This commit is contained in:
Seth R. Johnson 2022-03-29 18:13:09 -04:00 committed by GitHub
parent f66e7aea94
commit 0367b73ed5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -405,9 +405,9 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage):
def flag_handler(self, name, flags): def flag_handler(self, name, flags):
is_cce = self.spec.satisfies('%cce') is_cce = self.spec.satisfies('%cce')
spec = self.spec
if name == 'cxxflags': if name == 'cxxflags':
spec = self.spec
if '+mumps' in spec: if '+mumps' in spec:
# see https://github.com/trilinos/Trilinos/blob/master/packages/amesos/README-MUMPS # see https://github.com/trilinos/Trilinos/blob/master/packages/amesos/README-MUMPS
flags.append('-DMUMPS_5_0') flags.append('-DMUMPS_5_0')
@ -418,8 +418,17 @@ def flag_handler(self, name, flags):
flags.append('-no-ipo') flags.append('-no-ipo')
if '+wrapper' in spec: if '+wrapper' in spec:
flags.append('--expt-extended-lambda') flags.append('--expt-extended-lambda')
elif name == 'ldflags' and is_cce: elif name == 'ldflags':
if is_cce:
flags.append('-fuse-ld=gold') flags.append('-fuse-ld=gold')
if spec.satisfies('platform=linux ~cuda'):
# TriBITS explicitly links libraries against all transitive
# dependencies, leading to O(N^2) library resolution. When
# CUDA is enabled (possibly only with MPI as well) the linker
# flag does not propagate correctly.
flags.append('-Wl,--as-needed')
elif spec.satisfies('+stk +shared platform=darwin'):
flags.append('-Wl,-undefined,dynamic_lookup')
if is_cce: if is_cce:
return (None, None, flags) return (None, None, flags)