Although #213, accepted in #184, did apparently fix part of the problem, Boost.Context's own example programs still segfault due to the _XOPEN_SOURCE issue described in that pull request: if a Boost.Context client includes (for example) a standard C++ header before a Boost.Context one, _XOPEN_SOURCE is not defined when the ucontext struct is defined, resulting in its definition having fewer fields than when _XOPEN_SOURCE is defined, as Boost.Context expects it to be. Thus the segfault.
For example, I fixed the fibonacci example's segfault by moving #include <boost/context/fiber.hpp> above the inclusions of the stdlib headers.
Seems like the best workaround at this point is to export -D_XOPEN_SOURCE to clients from Boost.Context's build.
Although #213, accepted in #184, did apparently fix part of the problem, Boost.Context's own example programs still segfault due to the
_XOPEN_SOURCEissue described in that pull request: if a Boost.Context client includes (for example) a standard C++ header before a Boost.Context one,_XOPEN_SOURCEis not defined when theucontextstruct is defined, resulting in its definition having fewer fields than when_XOPEN_SOURCEis defined, as Boost.Context expects it to be. Thus the segfault.For example, I fixed the fibonacci example's segfault by moving
#include <boost/context/fiber.hpp>above the inclusions of the stdlib headers.Seems like the best workaround at this point is to export
-D_XOPEN_SOURCEto clients from Boost.Context's build.