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.
This commit is contained in:
Tom Payerle 2021-11-02 12:31:10 -04:00 committed by GitHub
parent b8a44870a4
commit eee4522103
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -731,13 +731,18 @@ def filter_python(self):
# 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: