Fix Windows/MinGW build and inference#1
Open
sd983527 wants to merge 1 commit into
Open
Conversation
Three portability issues prevented building and running on Windows with MinGW GCC: - clock_gettime/CLOCK_MONOTONIC/struct timespec are POSIX-only and absent under MinGW. Add include/time_compat.h, a std::chrono-based shim that is a no-op on platforms that already provide clock_gettime. - llama.cpp aborts model load with "PrefetchVirtualMemory unavailable" on MinGW builds. Disable mmap (use_mmap = false) for LM loading on _WIN32. - The VAE compute context reserves 128 GB, which relies on Linux memory overcommit and fails outright on Windows. Cap the reservation at 6 GB on _WIN32, which is ample for the intermediate tensors. Verified end-to-end: builds with MinGW GCC 13.2 (Ninja) and transcribes correctly on CPU. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three portability issues that prevented building and running VibeASR.cpp on Windows with MinGW GCC. With these changes the project builds with MinGW GCC 13.2 (Ninja) and transcribes correctly on CPU.
Changes
clock_gettimeis POSIX-only —clock_gettime/CLOCK_MONOTONIC/struct timespecare unavailable under MinGW, breakingsrc/vae.cpp,src/asr_server.cpp, anddemo/asr_infer.cpp. Addedinclude/time_compat.h, astd::chrono-based shim that is a no-op on platforms that already provideclock_gettime.PrefetchVirtualMemory unavailable. Setuse_mmap = falsefor LM loading, guarded by#ifdef _WIN32.#ifdef _WIN32(ample for the intermediate tensors).All changes are guarded so Linux/macOS behavior is unchanged.
Test plan
cmake -B build -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++)asr_inferon a 16 kHz mono WAV (JFK sample) — transcription is correct#ifdef _WIN32-guarded / no-op shim)Note
On Windows the top-level
CMakeLists.txtstill requires Clang or GCC (MSVC is rejected), so users must point CMake at a MinGW/Clang toolchain, e.g.-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++. This PR does not change that requirement.🤖 Generated with Claude Code