whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

fix building & UTF8 output with MSVC + SDL2

Open foldl opened this issue 10 months ago • 5 comments

This PR could also solve the issue mentioned in #2804, in which, TDM64 (gcc compiler) is used because MSVC failed to build.

Note: example lsp talks to vim script through std IO, so not updated.

foldl avatar Feb 19 '25 06:02 foldl

#2804 is 99.99% just SDL2.dll not being with the binaries. So I'm a little confused by this PR's naming.

rabidcopy avatar Feb 20 '25 02:02 rabidcopy

#2804 is 99.99% just SDL2.dll not being with the binaries. So I'm a little confused by this PR's naming.

With this PR, MSVC can be used to build with SDL2. This is an issue mentioned in #2804, in which, since MSVC failed to build, TDM64 (gcc compiler) is used.

foldl avatar Feb 20 '25 03:02 foldl

Thanks, this fixes the whisper-stream build for me on Win10 with MSVC, but the app is exiting immediately after launch with no indication of why:

C:\Users\ryan\Speech\whisper.cpp>.\build\bin\Release\whisper-stream.exe -m .\ggml-large-v3.bin
init: found 2 capture devices:
init:    - Capture device #0: 'Headset Microphone (Logitech Mono H650e)'
init:    - Capture device #1: 'Headset (Ryan’s AirPods Pro - Find My Hands-Free AG Audio)'
init: attempt to open default capture device ...
init: obtained spec for input device (SDL Id = 2):
init:     - sample rate:       16000
init:     - format:            33056 (required: 33056)
init:     - channels:          1 (required: 1)
init:     - samples per frame: 1024
whisper_init_from_file_with_params ...
whisper_init_from_file_with_params_no_state: loading model from '.\ggml-large-v3.bin'
whisper_init_with_params_no_state: use gpu    = 1
whisper_init_with_params_no_state: flash attn = 0
whisper_init_with_params_no_state: gpu_device = 0
whisper_init_with_params_no_state: dtw        = 0
ggml_vulkan: Found 1 Vulkan devices:
ggml_vulkan: 0 = AMD Radeon RX 7900 XT (AMD proprietary driver) | uma: 0 | fp16: 1 | warp size: 64 | matrix cores: KHR_coopmat
whisper_init_with_params_no_state: devices    = 2
whisper_init_with_params_no_state: backends   = 2
whisper_model_load: loading model
whisper_model_load: n_vocab       = 51866
whisper_model_load: n_audio_ctx   = 1500
whisper_model_load: n_audio_state = 1280
whisper_model_load: n_audio_head  = 20
whisper_model_load: n_audio_layer = 32
whisper_model_load: n_text_ctx    = 448
whisper_model_load: n_text_state  = 1280
whisper_model_load: n_text_head   = 20
whisper_model_load: n_text_layer  = 32
whisper_model_load: n_mels        = 128
whisper_model_load: ftype         = 1
whisper_model_load: qntvr         = 0
whisper_model_load: type          = 5 (large v3)
whisper_model_load: adding 1609 extra tokens
whisper_model_load: n_langs       = 100

C:\Users\ryan\Speech\whisper.cpp>

tokyovigilante avatar Feb 20 '25 09:02 tokyovigilante

@tokyovigilante You need to copy SDL2.dll to C:\Users\ryan\Speech\whisper.cpp\build\bin\Release, or add it to PATH.

foldl avatar Feb 20 '25 09:02 foldl

Thanks for looking, I think this should be ok?

Directory of C:\Users\ryan\Speech\whisper.cpp\build\bin\Release

20/02/2025  10:05 pm    <DIR>          .
20/02/2025  10:05 pm    <DIR>          ..
20/02/2025  09:40 pm            27,136 bench.exe
20/02/2025  09:40 pm            27,136 command.exe
20/02/2025  09:40 pm           487,936 ggml-base.dll
20/02/2025  09:40 pm           322,048 ggml-cpu.dll
20/02/2025  09:40 pm        20,034,048 ggml-vulkan.dll
20/02/2025  09:40 pm            75,264 ggml.dll
20/02/2025  10:05 pm           184,832 lsp.exe
20/02/2025  09:40 pm            27,136 main.exe
20/02/2025  09:40 pm           107,520 quantize.exe
20/02/2025  09:11 pm         1,664,000 SDL2.dll
20/02/2025  09:40 pm            27,136 stream.exe
20/02/2025  10:05 pm           165,888 wchess.exe
20/02/2025  09:40 pm            20,480 whisper-bench.exe
20/02/2025  09:40 pm           183,808 whisper-cli.exe
20/02/2025  10:05 pm           167,936 whisper-command.exe
20/02/2025  10:05 pm           407,040 whisper-server.exe
20/02/2025  10:05 pm            81,920 whisper-stream.exe
20/02/2025  10:05 pm         1,200,128 whisper-talk-llama.exe
20/02/2025  09:40 pm           438,272 whisper.dll
              19 File(s)     25,649,664 bytes
               2 Dir(s)  33,750,409,216 bytes free

[EDIT] Hmm, seems to run on Windows for me with the -ng flag, despite having the Vulkan SDK installed (7900 XT). Have just tried on Linux with the mainline code whiich works fine with my GPU. I really need to use this with a Windows app unfortunately, but this is clearly not the issue. Sorry for the noise.

tokyovigilante avatar Feb 20 '25 09:02 tokyovigilante

@foldl Sorry about the delay on this. Would you be able rebase this and resolve conflicts here and we should be able to merge this.

danbev avatar May 12 '25 16:05 danbev