Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault with ucontext on macOS (#184, continued) #238

Open
francoisk opened this issue Sep 6, 2023 · 3 comments
Open

Segfault with ucontext on macOS (#184, continued) #238

francoisk opened this issue Sep 6, 2023 · 3 comments

Comments

@francoisk
Copy link

francoisk commented Sep 6, 2023

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.

@olk
Copy link
Member

olk commented Oct 1, 2023

Could you check if this issue is solved by #236 (branch develop)?! I can't do it because I don't own a MAC system.

@francoisk
Copy link
Author

Finally got to it but looks like the problem persists. I tested develop at be271d3e4758b260947b9b0c20855c1ba33cf346. The fibonacci example still segfaults and moving the fiber.hpp include to the top still fixes it.

@olk
Copy link
Member

olk commented Mar 10, 2024

seams to be an issue of defining _XOPEN_SOURCE in fiber.hpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants