-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Fix for LLAMA_WIN_VER default value, fixes #5158 #5298
Fix for LLAMA_WIN_VER default value, fixes #5158 #5298
Conversation
bc742a2
to
be494d4
Compare
Updated CMakeLists.txt to set `LLAMA_WIN_VER` with `set()` instead of `option()` (which is specifically for booleans).
be494d4
to
ed6b91d
Compare
Looks correct, but do you know why it wasn't caught when |
My guess is that it's because of a difference in how the MinGW and MSVC toolchains handle an unsupported MinGW likely either defaults to an older set of headers, or excludes certain headers altogether, resulting in the error
If MinGW defaults to a version before 0x0400, we'd expect to get the error in issue #5158. MSVC likely defaults to a newer version of _WIN32_WINNT, probably the the latest version of Windows that the SDK supports. Since the Windows builds in Do you think it would be worthwhile to add a check for MinGW? |
As far as I understand the Lines 956 to 959 in ed6b91d
So I don't think this is related to MSVC, but maybe something changed in MinGW since that was merged. |
Ah, you're right. So not a difference between toolchains, but the issue still wouldn't be caught by the pipeline, unless there's a MinGW action I've missed in |
That would be me. My bad. I was explictly testing it with -DLLAMA_WIN_VER=0x501 and it was working fine. Apparently it's a Boolean option and yet CMake overrides it with a working int value? That is some unintuitive bug. The idea was to ensure we explictly define the version for older OSes and catch unintended compile time and runtime issues through explicit compiler guards, as quoted above. Did not catch this one. Sorry, and thank you for this patch. |
Yeah agreed, the CMake behavior is really unintuitive - I would hope that OPTION() would throw an error when set with a non boolean value. Moreover, when left at the default |
option() is specifically for booleans. Fixes ggerganov#5158
option() is specifically for booleans. Fixes ggerganov#5158
Fix for #5158
Updated CMakeLists.txt to set the default value for
LLAMA_WIN_VER
withset()
instead ofoption()
(which is specifically for booleans).I encountered the issue when I updated my Java JNI project to tag b2050, and my MinGW build broke.
Confirmed the bug with this diagnostic in CMakeLists.txt:
Which resulted in:
So, unless
LLAMA_WIN_VER
is supplied by a user def, this value defaults toOFF
instead of the intended0x602
. Since I wasn't specifying the def, the MinGW build failed.The
option()
command is for boolean values, and it looks like cmake defaults toOFF
if it can't parse the parameter.Switching from
option()
toset()
fixed the issue:I also confirmed that specifying
LLAMA_WIN_VER
still works after my update by passing-DLLAMA_WIN_VER=0x400
: