Skip to content

fix building & UTF8 output with MSVC + SDL2 #2826

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

foldl
Copy link
Collaborator

@foldl foldl commented Feb 19, 2025

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 foldl changed the title fix building with MSVC + SDL2 fix building & UTF8 output with MSVC + SDL2 Feb 19, 2025
@rabidcopy
Copy link

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

@foldl
Copy link
Collaborator Author

foldl commented Feb 20, 2025

#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.

Copy link
Member

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI errors are unrelated to this change. If the errors persist, we can apply the same fix that we did in llama.cpp: ggml-org/llama.cpp#11895

@tokyovigilante
Copy link

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>

@foldl
Copy link
Collaborator Author

foldl commented Feb 20, 2025

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

@tokyovigilante
Copy link

tokyovigilante commented Feb 20, 2025

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.

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.

4 participants