You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Linux Raccoon 26.04 and vscode with cmake add-in. The gcc version is 15.
According to readme file included, I used the manual mode by adding as subdirectory and target link. And sample code in readme file for testing purpose. After compiling and running I got a segmentation fault.
Another issue is about execution header which cause intellisense problem. By changing following precessor to zero the problem resolved.
#define STDEXEC_MSVC_HEADERS() 1
One more point, if using as header only, the compiler error says require c++20.
I compiled all examples and tested randomly without any issue. But my simple project does not.
I can reproduce the crash on main (2bc0681), in Docker with GCC 12 and Clang 21 (Debian 12) and GCC 16 (Fedora). Built with only -I<stdexec>/include, the README example crashes in get_parallel_scheduler(): query_parallel_scheduler_backend is declared weak and nothing defines it, so the call goes to address 0.
#2349 documents the two ways to provide the backend. The second one, -DSTDEXEC_BUILD_PARALLEL_SCHEDULER=ON and linking STDEXEC::parallel_scheduler, also crashes for me. I used a small CMake project with add_subdirectory(stdexec) and the README example:
STDEXEC::parallel_scheduler
GCC 12
Clang 21
static library (the default)
crash
crash
shared library
crash
works
The program has only a weak reference to the backend, and a weak reference does not pull an object file out of a static library. Debian's GCC also links with --as-needed by default, which drops a shared library that only satisfies weak references. Defining STDEXEC_PARALLEL_SCHEDULER_HEADER_ONLY works with both compilers.
I'd like to fix this, in two parts:
In get_parallel_scheduler(), check the address of the weak function first, and throw a std::runtime_error that says how to provide a backend, instead of calling a null pointer. I have this working locally.
Make the library route work. One way: STDEXEC::parallel_scheduler adds a compile definition for its users, and with it the header declares query_parallel_scheduler_backend without weak. Users of the library then have a normal reference, which pulls in the backend, while the library's own definition stays weak and can still be replaced. I haven't tried this yet.
Would you take a PR for both? Or do you prefer another fix for the second part?
Activity
veljjanoski commentedon Nov 1, 2026
I can reproduce the crash on main (2bc0681), in Docker with GCC 12 and Clang 21 (Debian 12) and GCC 16 (Fedora). Built with only
-I<stdexec>/include, the README example crashes inget_parallel_scheduler():query_parallel_scheduler_backendis declared weak and nothing defines it, so the call goes to address 0.#2349 documents the two ways to provide the backend. The second one,
-DSTDEXEC_BUILD_PARALLEL_SCHEDULER=ONand linkingSTDEXEC::parallel_scheduler, also crashes for me. I used a small CMake project withadd_subdirectory(stdexec)and the README example:STDEXEC::parallel_schedulerThe program has only a weak reference to the backend, and a weak reference does not pull an object file out of a static library. Debian's GCC also links with
--as-neededby default, which drops a shared library that only satisfies weak references. DefiningSTDEXEC_PARALLEL_SCHEDULER_HEADER_ONLYworks with both compilers.I'd like to fix this, in two parts:
get_parallel_scheduler(), check the address of the weak function first, and throw astd::runtime_errorthat says how to provide a backend, instead of calling a null pointer. I have this working locally.STDEXEC::parallel_scheduleradds a compile definition for its users, and with it the header declaresquery_parallel_scheduler_backendwithoutweak. Users of the library then have a normal reference, which pulls in the backend, while the library's own definition stays weak and can still be replaced. I haven't tried this yet.Would you take a PR for both? Or do you prefer another fix for the second part?
Claude (Anthropic) was used as assistant.