From 047bfb5c907eb929d29c78f55e8a453ccbff8483 Mon Sep 17 00:00:00 2001 From: Arshath Date: Fri, 21 Nov 2025 04:39:33 +0530 Subject: [PATCH] Update ggml-decoder.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hitting error while compiling on windows: error C3861: 'unsetenv': identifier not found Reason: unsetenv() is a POSIX function; it doesn’t exist on Windows. Visual Studio (MSVC) won’t recognize it. Proposed fix: Use _putenv_s() (Windows equivalent) This is supported by MSVC and achieves the same effect: it removes the environment variable from the process environment. This keeps cross-platform compatibility. --- ggml/src/ggml-openvino/ggml-decoder.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-openvino/ggml-decoder.cpp b/ggml/src/ggml-openvino/ggml-decoder.cpp index c00efaf6ae..ae559e41b9 100644 --- a/ggml/src/ggml-openvino/ggml-decoder.cpp +++ b/ggml/src/ggml-openvino/ggml-decoder.cpp @@ -63,10 +63,20 @@ GgmlOvDecoder::GgmlOvDecoder(ggml_cgraph * cgraph, m_is_static(is_static), m_cgraph(cgraph), m_op_name(m_node ? std::string(m_node->name) : ""), - m_model_weights(model_weights) { + m_model_weights(model_weights), + /*m_is_static(is_static) { if (auto * env = getenv("GGML_OPENVINO_PRINT_CGRAPH_TENSOR_ADDRESS"); env && std::string(env) != "0") { unsetenv("GGML_OPENVINO_PRINT_CGRAPH_TENSOR_ADDRESS"); print_tensor_address_map(cgraph); + }*/ + m_is_static(is_static) { + if (auto* env = getenv("GGML_OPENVINO_PRINT_CGRAPH_TENSOR_ADDRESS"); env && std::string(env) != "0") { + #ifdef _WIN32 + _putenv_s("GGML_OPENVINO_PRINT_CGRAPH_TENSOR_ADDRESS", ""); + #else + unsetenv("GGML_OPENVINO_PRINT_CGRAPH_TENSOR_ADDRESS"); + #endif + print_tensor_address_map(cgraph); } set_llm_params();