Skip to content

QVAC-18966: tts-cpp — add missing <atomic> include in chatterbox_tts.cpp#27

Merged
GustavoA1604 merged 1 commit into
tetherto:masterfrom
Zbig9000:QVAC-18966-tts-cpp-chatterbox-atomic-include
May 20, 2026
Merged

QVAC-18966: tts-cpp — add missing <atomic> include in chatterbox_tts.cpp#27
GustavoA1604 merged 1 commit into
tetherto:masterfrom
Zbig9000:QVAC-18966-tts-cpp-chatterbox-atomic-include

Conversation

@Zbig9000

Copy link
Copy Markdown

Summary

One-line fix. tts-cpp/src/chatterbox_tts.cpp declares

static std::atomic<int> g_s3gen_cache_refcount{0};

at line ~189 (and later uses .fetch_add(), .fetch_sub(), .store()), but the translation unit never #include <atomic> directly. libstdc++ has historically exposed std::atomic transitively via <mutex> so the build appears clean on most setups, but the transitive path is being trimmed in the ggml-speech v0.10.2 sync currently in flight on tetherto/qvac-ext-ggml#13. On the merged speech HEAD, chatterbox_tts.cpp fails to compile with:

chatterbox_tts.cpp:189:30: error: aggregate 'std::atomic<int> g_s3gen_cache_refcount'
                                  has incomplete type and cannot be defined

The fault reproduces on the pre-merge speech HEAD too if you trim a few headers — the include chain has just been hiding a latent bug.

Add #include <atomic> explicitly. No behavioural change; safe under any header transitivity.

Tasks

  • QVAC-18966 (Asana) — TTS-GGML CPU regression / build-fix series. This is the build half (chatterbox_tts.cpp no longer relies on transitive <atomic>).

Validation

Clean rebuild of tts-cpp (master + this PR) against a shared-libs install of tetherto/qvac-ext-ggml#13 HEAD 45dbdecd (the day-2 v0.10.2 merge target):

# install ggml-speech as shared libs
cmake -S qvac-ext-ggml -B build-install -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=/tmp/ggml-speech-install/usr/local \
  -DBUILD_SHARED_LIBS=ON -DGGML_LIB_OUTPUT_PREFIX=qvac-speech- \
  -DGGML_VULKAN=ON -DGGML_NATIVE=OFF
cmake --build build-install -j && cmake --install build-install

# rebuild tts-cpp against it
cmake -S qvac-ext-lib-whisper.cpp/tts-cpp -B tts-validate -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_PREFIX_PATH="…;/tmp/ggml-speech-install/usr/local" \
  -DTTS_CPP_BUILD_LIBRARY=ON
cmake --build tts-validate -j
# -> libtts-cpp.a built clean, chatterbox_tts.cpp.o compiled in 3 variants

Notes

  • Purely additive (a single #include <atomic> line). Independent of every other PR in the QVAC-18991 / 18992 / 18993 series.
  • Cherry-picked off the combined QVAC-18993-bundled-ggml-android-dynamic-backend branch where it was originally written; that combined branch will be closed in favour of this PR (single-concern) plus the QVAC-18993 ggml-bundled PR (the other two commits).

Made with Cursor

g_s3gen_cache_refcount (line ~189) is declared as
`static std::atomic<int>` and is later used with `.fetch_add()`,
`.fetch_sub()`, `.store()`, but the translation unit only pulls in
ggml/cstring/stl headers — never `<atomic>` directly. libstdc++
happens to expose `std::atomic` transitively via `<mutex>` on most
hosts so the build appears clean, but on the ggml-speech sync path
where header transitivity changes (the qvac-ext-ggml@speech merge
of ggml-org v0.10.2 cuts a few of those transitive paths) the
translation unit fails with:

    chatterbox_tts.cpp:189: variable `std::atomic<int>
    g_s3gen_cache_refcount' has initializer but incomplete type

Reproduces on the pre-merge speech HEAD too -- it was previously
hidden by header transitivity. Add `#include <atomic>` explicitly.

Verified by a clean rebuild of tts-cpp against an `-DBUILD_SHARED_LIBS=ON`
install of qvac-ext-ggml@speech HEAD (45dbdecd, day-2 ggml-speech).

Co-authored-by: Cursor <cursoragent@cursor.com>
@GustavoA1604 GustavoA1604 merged commit 29c0320 into tetherto:master May 20, 2026
59 of 66 checks passed
gianni-cor pushed a commit that referenced this pull request May 28, 2026
)

Adds a small 'QVAC speech-stack ports' section between the upstream
whisper.cpp intro media and the 'Quick start' section, pointing at
the two in-tree subtrees this fork carries:

- tts-cpp/ - Chatterbox (Turbo + Multilingual) + Supertonic TTS,
  in-tree subtree of github.com/gianni-cor/chatterbox.cpp.
- parakeet-cpp/ - NVIDIA Parakeet FastConformer ASR + Sortformer
  diarization, in-tree subtree of the parakeet.cpp standalone repo.

Both consume ggml through the `ggml-speech` vcpkg port (the
qvac-ext-ggml/speech branch).  Each subtree has its own README, build
flow, and public C++ API; the upstream whisper.cpp build below the new
section is unaffected.

Closes review #27 ('one-line pointer to tts-cpp/ from the top-level
qvac-ext-lib-whisper.cpp/README.md').  The reviewer specifically asked
for tts-cpp; included parakeet-cpp at the same time so a future
'fix the un-fixed parakeet-cpp version of this bullet' commit doesn't
need to revisit the same paragraph.

Co-authored-by: Cursor <cursoragent@cursor.com>
gianni-cor pushed a commit that referenced this pull request May 28, 2026
…omic-include

QVAC-18966: tts-cpp — add missing <atomic> include in chatterbox_tts.cpp
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

Successfully merging this pull request may close these issues.

2 participants