Open
Description
We want to make sure that calls to amrex::Abort()
& general exceptions from, e.g., throw std::runtime_error(...)
s, can be propagated across dynamic libraries of AMReX, ABLASTR, etc. up to app Python bindings. In other words: an amrex::Abort()
called from routines that are compiled into the AMReX .so
file, e.g. amrex::ParmParse::get()
, should be able to be caught as a runtime error in WarpX/ImpactX.
See description in BLAST-ImpactX/impactx#265 for details.
- set
amrex.signal_handling = 0
andamrex.throw_exception = 1
in Python runs - proper
amrex::Abort
support: enable working, cross-dynamic-librarythrow std::runtime_error
exceptions- macOS: e.g., RTTI flags on AppleClang ?
- Linux: e.g.,
-shared-libgcc
on Linux (or useg++
for linking) - since RTTI is the default with all modern compilers, this could also be related to symbol stripping in pybind11 release builds: https://stackoverflow.com/a/17923224/2719194 - which conda-forge seems to handle well (see links below)
- make sure users can still trigger backtraces if they want to
Might also addressable via a custom system::error_handler
:
https://github.com/AMReX-Codes/amrex/blob/b84d7c069cef7470f195b250926ca0e84ec46fb2/Src/Base/AMReX.cpp#L205-L206
Refs.:
- https://stackoverflow.com/questions/38878999/try-catch-doesnt-work-in-shared-library/38879990#38879990
- https://stackoverflow.com/questions/3638237/polymorphically-catching-an-exception-in-a-fno-rtti-shared-library-on-mac-os-x
- On conda-forge, run-time type information (RTTI) is the default (and used for more stuff than exceptions, e.g.,
dynamic_cast
,typeid
over library bounds) - https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html?highlight=rtti
- conda-forge: