-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
C++ Roadmap #45785
Comments
any reason why |
Good call - definitely on the roadmap. I updated the description slightly. A lot of things we would get "for free" with #43729. Big blocker for |
As far as C is concerned,
For C++, we could potentially adopt |
I've just read about it... It is so "broken". Both in C and C++... |
Just to try to help a little i can confirm that hacking up the c++conf.h and gthr.h for the compiler is sufficient to make shared_mutex/condition_variable/etc compile fine without changes.
(to not use the initializers which zephyr doesn't support) and gthr.h needs:
(I have no earthly idea why it's gated on ANDROID and not a GLIBCXX__PTHREADs macro or something) to use gthr-posix.h, you need CONFIG_POSIX_API=y CONFIG_APP_LINK_WITH_POSIX_SUBSYS=y With these changes, the compiler will compile shared_mutex/etc fine. Note that condition_variable (and i suspect other stuff) compiles but doesn't link. This is because all of this requires the libstc++ be compiled with threading support (and the config change), and at least the ones in zephyr-sdk (and my NRF sdk) are compiled both single threaded and obviously without the gthr changes. It's possible but a bad idea to do it without changing the threading model on the toolchains: agrees, saying: |
If you'd like to play around with a working mutex/condvar/shared_mutex, the following will let you do it. Then unzip
This will ensure the bits/c++config.h changes override the toolchain ones. I took a quick pass at hacking the toolchain to enable threads (IE CT_THREADS_POSIX=y) and change the os defines, but i'm still working on getting the environment to be the same as the CI workflow uses (I tried using act to execute it locally, and even if i revert back to pre-s3-download versions, still no luck). |
So, i got the toolchain to build normally (yay). Finally all my years of managing the crosstool team come in handy. Unfortunately, enabling threads doesn't "just work", as might be expected. It gets pretty far but eventually fails trying to compile emutls with the final toolchain due to some errors. Here's a preliminary checklist of work needed to make it work:
Everything but the last one should be straightforward. I hand edited around the last one in the build directory (hand-disabled emutls), and it succeeds in compiling libstdc++ with thread support. So once that header is the right one, it should work. Unfortunately, this is all the only way to get libstdc++ to compile the right files with threads enabled. Hacking around all this would be possible (that's what the std::thread pull request does) but the libstdc++ internal impls change quite a bit from version to version, and y'all don't require specific toolchain/zephyr combinations. I'm unfortunately out of time for a bit to hack more on this, but hopefully this is helpful |
Is anyone actively working on std::mutex support? I'd be interested in assisting with that (assuming it would be a wrapper around some zephyr primitives) but I'd need some pointers. |
it doesn't need anything other than toolchain support and the right defines.
It already works when you set up libstdc++ to use pthreads/etc, without any
changes to libstdc++ itself.
…On Wed, Dec 7, 2022 at 2:18 PM cmorganBE ***@***.***> wrote:
Is anyone actively working on std::mutex support? I'd be interested in
assisting with that (assuming it would be a wrapper around some zephyr
primitives) but I'd need some pointers.
—
Reply to this email directly, view it on GitHub
<#45785 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACPI24WPHJLBGC5LR2GX4DWMDPGVANCNFSM5WK6URVA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@dberlin and pthreads maps through to zephyr threads? why not enabled at the moment? |
Yes. |
Actually, the only remaining feature to support I recently made some POSIX changes which add #52316 has some additional POSIX subsystem fixes. To make our POSIX implementation more compatible with that of Newlib / PicoLibC, but it's waiting on reviews. |
Request: harmonize Rather than have a separate The main reason is that no tooling (including |
This issue describes the future plans for the C++ support in the Zephyr RTOS.
Tasks
std::mutex
,std::condition_variable
,std::counting_semaphore
, andstd::binary_semaphore
support (via gthr-posix.h, see below)std::thread
support (via gthr-posix.h, cpp: thread: support for std::thread, std::mutex, std::condition_variable, etc #43729)std::async
andstd::future
support C++ std::async and std::future support #31559Resources
The text was updated successfully, but these errors were encountered: