signal.h and swig on MinGW
Issue #611
resolved
On MinGW,
The swig wrapping fails with the following. It looks like swig does not know what sigaction is. It builds fine on Linux but something is missing to build on MinGW. I think I have to include signal.h somewhere for swig to get it but I don't know where.
FEniCS/src/dolfin/dorsal_build_dir/dolfin/swig/modules/common/modulePYTHON
_wrap.cxx:4674:24: error: aggregate 'dolfin::dolfin_terminate()::sigaction act' has incomplete type
and cannot be defined
struct sigaction act;
^
FEniCS/src/dolfin/dorsal_build_dir/dolfin/swig/modules/common/modulePYTHON
_wrap.cxx:4677:36: error: invalid use of incomplete type 'struct dolfin::dolfin_terminate()::sigaction'
sigaction(SIGABRT, &act, NULL);
^
FEniCS/src/dolfin/dorsal_build_dir/dolfin/swig/modules/common/modulePYTHON
_wrap.cxx:4674:14: note: forward declaration of 'struct dolfin::dolfin_terminate()::sigaction'
struct sigaction act;
Comments (7)
-
-
reporter Thanks Jan,
I tried that but that did not help. Looks like sigaction does not exist on MinGW. It's not present in my signal.h file. Does this hack seem sensible to you:
#include <signal.h> namespace dolfin { void dolfin_terminate() noexcept { #ifdef __MINGW32__ raise(SIGABRT); #else // Uninstall signal handlers of OpenMPI cluttering stderr struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = SIG_IGN; sigaction(SIGABRT, &act, NULL); #endif // We don't bother with MPI_Abort. This would require taking care of // MPI state. We just assume mpirun catches SIGABRT and sends SIGTERM // to other ranks. std::abort(); }
-
What about being consistent and use
std::abort()
while just omitting uninstallation of OpenMPI signal handler#include <signal.h> namespace dolfin { void dolfin_terminate() noexcept { // Uninstall signal handlers of OpenMPI cluttering stderr (does not work on MinGW) #ifndef __MINGW32__ struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = SIG_IGN; sigaction(SIGABRT, &act, NULL); #endif // We don't bother with MPI_Abort. This would require taking care of // MPI state. We just assume mpirun catches SIGABRT and sends SIGTERM // to other ranks. std::abort(); }
-
reporter Sure that works. Thanks.
-
reporter - changed status to resolved
-
Fixed by 7cdb3c4.
-
- removed milestone
Removing milestone: 1.7 (automated comment)
- Log in to comment
According to this SO thread, configuring with
could help. Can you try it?