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:
parent
b8a44870a4
commit
eee4522103
1 changed files with 7 additions and 2 deletions
|
@ -731,13 +731,18 @@ def filter_python(self):
|
||||||
# run-time error: Symbol not found: _PyBool_Type and prevents
|
# run-time error: Symbol not found: _PyBool_Type and prevents
|
||||||
# Trilinos to be used in any C++ code, which links executable
|
# Trilinos to be used in any C++ code, which links executable
|
||||||
# against the libraries listed in Trilinos_LIBRARIES. See
|
# against the libraries listed in Trilinos_LIBRARIES. See
|
||||||
# https://github.com/Homebrew/homebrew-science/issues/2148#issuecomment-103614509
|
# https://github.com/trilinos/Trilinos/issues/569 and
|
||||||
# A workaround is to remove PyTrilinos from the COMPONENTS_LIST :
|
# 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:
|
if '+python' in self.spec:
|
||||||
filter_file(r'(SET\(COMPONENTS_LIST.*)(PyTrilinos;)(.*)',
|
filter_file(r'(SET\(COMPONENTS_LIST.*)(PyTrilinos;)(.*)',
|
||||||
(r'\1\3'),
|
(r'\1\3'),
|
||||||
'%s/cmake/Trilinos/TrilinosConfig.cmake' %
|
'%s/cmake/Trilinos/TrilinosConfig.cmake' %
|
||||||
self.prefix.lib)
|
self.prefix.lib)
|
||||||
|
filter_file(r'-lpytrilinos', '',
|
||||||
|
'%s/Makefile.export.Trilinos' %
|
||||||
|
self.prefix.include)
|
||||||
|
|
||||||
def setup_run_environment(self, env):
|
def setup_run_environment(self, env):
|
||||||
if '+exodus' in self.spec:
|
if '+exodus' in self.spec:
|
||||||
|
|
Loading…
Reference in a new issue