From eee45221039e14545adda6ed55b5bc5fb5fa0949 Mon Sep 17 00:00:00 2001 From: Tom Payerle Date: Tue, 2 Nov 2021 12:31:10 -0400 Subject: trilinos: Additional fix for linking C code when built with PyTrilinos (#19834) This removes `-lpytrilinos` from Makefile.export.Trilinos so that C code trying to link against a Trilinos built with PyTrilinos does not fail due to undefined references to python routines (libpytrilinos is only used when importing PyTrilinos in python, in which case those references are already defined by Python). There was already a bit of code to do something similar for C codes importing Trilinos via a CMake mechanism, this extends that to a basic Makefile mechanism as well. This patch also updates the comments to remove a stale link discussing this issue, and replacing with links to the some Trilinos issue reports related to the matter. --- var/spack/repos/builtin/packages/trilinos/package.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index d302431d2d..f9365b4e0f 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -731,13 +731,18 @@ class Trilinos(CMakePackage, CudaPackage): # run-time error: Symbol not found: _PyBool_Type and prevents # Trilinos to be used in any C++ code, which links executable # against the libraries listed in Trilinos_LIBRARIES. See - # https://github.com/Homebrew/homebrew-science/issues/2148#issuecomment-103614509 - # A workaround is to remove PyTrilinos from the COMPONENTS_LIST : + # https://github.com/trilinos/Trilinos/issues/569 and + # https://github.com/trilinos/Trilinos/issues/866 + # A workaround is to remove PyTrilinos from the COMPONENTS_LIST + # and to remove -lpytrilonos from Makefile.export.Trilinos if '+python' in self.spec: filter_file(r'(SET\(COMPONENTS_LIST.*)(PyTrilinos;)(.*)', (r'\1\3'), '%s/cmake/Trilinos/TrilinosConfig.cmake' % self.prefix.lib) + filter_file(r'-lpytrilinos', '', + '%s/Makefile.export.Trilinos' % + self.prefix.include) def setup_run_environment(self, env): if '+exodus' in self.spec: -- cgit v1.2.3-60-g2f50