Repository navigation
fix(windows): use platform env helper in DeepSeek4 HIP path - #710
Merged
Merged
Conversation
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 native Windows/MSVC HIP build failure caused by direct POSIX ::setenv() calls in the DeepSeek4 backend.
Root Cause
server/src/deepseek4/deepseek4_backend.cpp contained 6 direct ::setenv() calls under #if defined(DFLASH27B_BACKEND_HIP) || defined(GGML_USE_HIP) with no Windows exclusion. On Windows/MSVC, ::setenv does not exist in the global namespace, causing compile failure.
Pre-fix Error
deepseek4_backend.cpp:169:15: error: no member named 'setenv' in the global namespace; did you mean 'getenv'? deepseek4_backend.cpp:169:45: error: too many arguments to function call, expected single argument '_VarName', have 3 arguments(6 identical errors at lines 169, 181, 201, 219, 246, 1494)
Fix
Replaced all 6 ::setenv(name, value, overwrite) calls with the existing set_environment_variable(name, value, overwrite) helper from common/platform_env.h, which delegates to _putenv_s() on Windows and ::setenv() on POSIX.
No new wrappers, no new includes, no changes to platform_env.h.
Changed Calls
All getenv guards, overwrite semantics, return-value checks, logging, HIP guards, and control flow are preserved unchanged.
Post-fix Build
Same native Windows environment:
POSIX Behavior
Unchanged. platform_env.h POSIX path still delegates to ::setenv(name, value, overwrite ? 1 : 0).
No Changes To
Related
::setenv()calls.