std::jthread in #410/#411 breaks libc++ consumers — it is an incomplete feature there, and both uses are measurement-only
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- android, cmake, cpp
- Bereich
- backend, build-system
Rechercherichtung
Read the two measurement-only uses in src/rtl8733b/Rtl8733bDevice.cpp and src/jaguar1/RtlJaguarDevice.cpp, introduced by #410 and #411, and compare their stop-token polling loops. Reproduce the libc++ build failure with an Android NDK toolchain, noting that r26 lacks the header and r27 requires -fexperimental-library. Done means resolving the libc++ compile failure without imposing an experimental-library requirement on consumers.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
std::jthread / std::stop_token entered the tree in #410 (src/rtl8733b/Rtl8733bDevice.cpp) and #411 (src/jaguar1/RtlJaguarDevice.cpp). devourer asks for cxx_std_20, which is correct in principle — but on libc++ these two are shipped as incomplete features, so a C++20 libc++ toolchain does not provide them by default. Any consumer building devourer against libc++ without -fexperimental-library now fails to compile.
What it looks like
src/jaguar1/RtlJaguarDevice.cpp:1621:8: error: no type named 'jthread' in namespace 'std'; did you mean 'thread'?
src/jaguar1/RtlJaguarDevice.cpp:1635:47: error: no type named 'stop_token' in namespace 'std'
followed by a cascade of variable ... cannot be implicitly captured in a lambda with no capture-default specified from the lambda that was meant to take std::stop_token.
Why the standard level is not the lever
In libc++'s __config:
# if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY)
# define _LIBCPP_HAS_NO_INCOMPLETE_PSTL
# define _LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN
...
and __thread/jthread.h is guarded on _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN). <thread> includes that header unconditionally, so it simply declares no jthread — at any -std= level.
Measured on the Android NDK, which is the case I hit:
| NDK | libc++ | result |
|---|---|---|
| r26.3 | no <stop_token> header at all |
cannot build, no flag helps |
| r27.3 | header present, gated | builds only with -fexperimental-library |
libstdc++ has had jthread since GCC 10, so glibc/GCC targets are unaffected — which is likely why CI is green.
What makes this worth raising
Both uses are measurement-only paths. The Jaguar1 one is reached only when DEVOURER_ACK_DISARM_AFTER_MS is set — the comment above it says "Measurement-only live disarm". So an opt-in debug feature that most consumers will never enable is imposing a libc++-experimental requirement on all of them, at compile time.
Options, in the order I'd suggest
- Drop
jthreadforstd::thread+ an atomic stop flag. Both sites already poll in a 25 ms quantum loop and already hold a mutex for the real work, so the stop token is buying very little; astd::atomic<bool>plus an explicit join in the same scope is a near-mechanical substitution and removes the dependency outright. - Guard the feature, so the code compiles only where the library has it (
#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)or a CMake option). Keeps the feature for the toolchains that can build it. - Document it — state the libc++ requirement and that consumers need
-fexperimental-library. Cheapest, but it leaves the trap in place for the next consumer, and a measurement-only path is a surprising thing to pay for.
Happy to send a PR for (1) if you think it is the right shape.
Workaround in the meantime
Target-scoped, from the consumer's own CMake, not a patch to devourer:
if(ANDROID)
target_compile_options(devourer PRIVATE -fexperimental-library)
endif()
plus NDK r27 or newer — r26 cannot be rescued this way, as the header is absent.
- Vorherrschende Sprache
- C
- Sterne
- 56
- Forks
- 29
- Ø Merge
- 3 Std. 43 Min.
- Gemergte PRs (30 T.)
- 75
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus OpenIPC/devourer
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Follow-ups left open by the 8822B fast bandwidth toggle fix (#584)Evtl. vergeben @josephnef hat das heute übernommen. Offenenhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 42/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 12/100
OpenIPC/devourer#579 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 12/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 8/100
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in OpenIPC/devourer
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Needs-Triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 2 Tagen
-
issue: bug report
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 2 Tagen
-
cross-platform fix-now
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
feature:index kind:crash status:confirmed triaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
clice-io/clice#1123 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag