From 70bbd8280433514b26fb984a96b434683533dfeb Mon Sep 17 00:00:00 2001 From: Simeon David Schaub Date: Sat, 25 Jul 2026 14:49:55 +0200 Subject: [PATCH 1/3] build: various mingw fixes These were needed in order to cross-compile for windows in JuliaPackaging/Yggdrasil#14225. There were some additional patches in that PR, but I excluded the more controversial/hacky fixes for now. Some of the patches were written with help from Claude, but verified and reviewed one-by-one. Signed-off-by: Simeon David Schaub --- src/runtime_src/core/common/detail/windows/trace.h | 12 +++++++++++- src/runtime_src/core/common/detail/windows/utils.h | 5 +++++ src/runtime_src/core/common/smi/smi.h | 4 ++-- .../core/include/xrt/detail/windows/types.h | 2 +- .../xclbinutil/aie-pdi-transform/src/CMakeLists.txt | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/runtime_src/core/common/detail/windows/trace.h b/src/runtime_src/core/common/detail/windows/trace.h index 39fa34956aa..522b9e13632 100644 --- a/src/runtime_src/core/common/detail/windows/trace.h +++ b/src/runtime_src/core/common/detail/windows/trace.h @@ -23,7 +23,17 @@ #include "core/common/trace.h" #include #include -#include +#ifdef __MINGW32__ +// MinGW has no TraceLoggingProvider.h (Windows ETW); stub the API to no-ops. +# define TRACELOGGING_DECLARE_PROVIDER(...) +# define TRACELOGGING_DEFINE_PROVIDER(...) +# define TraceLoggingRegister(...) +# define TraceLoggingUnregister(...) +# define TraceLoggingWrite(...) +# define TraceLoggingValue(...) +#else +# include +#endif // Forward declare the logging provider object. The provider // is defined in a single compilation unit (core/common/trace.cpp). diff --git a/src/runtime_src/core/common/detail/windows/utils.h b/src/runtime_src/core/common/detail/windows/utils.h index 1a6eda9816c..a645c30d2e9 100644 --- a/src/runtime_src/core/common/detail/windows/utils.h +++ b/src/runtime_src/core/common/detail/windows/utils.h @@ -52,6 +52,7 @@ sys_dep_get_last_err_msg() inline std::string getenv(const char* name) { +#ifdef _MSC_VER char* value = nullptr; size_t len = 0; @@ -62,6 +63,10 @@ getenv(const char* name) // Use unique_ptr to ensure memory is freed even if string constructor throws std::unique_ptr guard(value, &std::free); return std::string(guard.get()); +#else + const char* value = std::getenv(name); + return value ? std::string(value) : std::string{}; +#endif } inline std::string diff --git a/src/runtime_src/core/common/smi/smi.h b/src/runtime_src/core/common/smi/smi.h index 5bd71d1a691..78fefb27f4b 100644 --- a/src/runtime_src/core/common/smi/smi.h +++ b/src/runtime_src/core/common/smi/smi.h @@ -30,7 +30,7 @@ struct basic_option { std::string m_type; }; -class option : public basic_option { +class XRT_CORE_COMMON_EXPORT option : public basic_option { std::string m_alias; std::string m_default_value; std::string m_value_type; @@ -76,7 +76,7 @@ class option : public basic_option { // This class is used to represent an option with a multiline description. // For example, --run can have multiple test names as its description. // These subnames are also queried using the generic API get_list -class listable_description_option : public option { +class XRT_CORE_COMMON_EXPORT listable_description_option : public option { std::vector m_description_array; public: listable_description_option(std::string name, diff --git a/src/runtime_src/core/include/xrt/detail/windows/types.h b/src/runtime_src/core/include/xrt/detail/windows/types.h index c5852e54ad1..746eff7d6d9 100644 --- a/src/runtime_src/core/include/xrt/detail/windows/types.h +++ b/src/runtime_src/core/include/xrt/detail/windows/types.h @@ -19,7 +19,7 @@ #include -#ifndef __GNU__ +#ifndef __GNUC__ typedef int64_t ssize_t; typedef int pid_t; #endif diff --git a/src/runtime_src/tools/xclbinutil/aie-pdi-transform/src/CMakeLists.txt b/src/runtime_src/tools/xclbinutil/aie-pdi-transform/src/CMakeLists.txt index 1354017cc8d..6cf6f333081 100644 --- a/src/runtime_src/tools/xclbinutil/aie-pdi-transform/src/CMakeLists.txt +++ b/src/runtime_src/tools/xclbinutil/aie-pdi-transform/src/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2018-2022 Xilinx, Inc. All rights Reserved. # Copyright (C) 2022-2026 Advanced Micro Devices, Inc. All rights Reserved. -if(NOT WIN32) +if(NOT MSVC) add_compile_options(-Wextra -fvisibility=default) else() add_compile_options(/wd4244 /wd4267 /wd4477 /wd4245) From f28ae80867c6a6b0a9a1a233cc9ccd3867a6b134 Mon Sep 17 00:00:00 2001 From: Simeon David Schaub Date: Sat, 25 Jul 2026 16:51:50 +0200 Subject: [PATCH 2/3] drop trace patch Signed-off-by: Simeon David Schaub --- src/runtime_src/core/common/detail/windows/trace.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/runtime_src/core/common/detail/windows/trace.h b/src/runtime_src/core/common/detail/windows/trace.h index 522b9e13632..39fa34956aa 100644 --- a/src/runtime_src/core/common/detail/windows/trace.h +++ b/src/runtime_src/core/common/detail/windows/trace.h @@ -23,17 +23,7 @@ #include "core/common/trace.h" #include #include -#ifdef __MINGW32__ -// MinGW has no TraceLoggingProvider.h (Windows ETW); stub the API to no-ops. -# define TRACELOGGING_DECLARE_PROVIDER(...) -# define TRACELOGGING_DEFINE_PROVIDER(...) -# define TraceLoggingRegister(...) -# define TraceLoggingUnregister(...) -# define TraceLoggingWrite(...) -# define TraceLoggingValue(...) -#else -# include -#endif +#include // Forward declare the logging provider object. The provider // is defined in a single compilation unit (core/common/trace.cpp). From f98cb4d0905216359d2a3359c5444f06925095b2 Mon Sep 17 00:00:00 2001 From: Simeon David Schaub Date: Sat, 25 Jul 2026 17:35:21 +0200 Subject: [PATCH 3/3] drop `XRT_CORE_COMMON_EXPORT` patch Signed-off-by: Simeon David Schaub --- src/runtime_src/core/common/smi/smi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime_src/core/common/smi/smi.h b/src/runtime_src/core/common/smi/smi.h index 78fefb27f4b..5bd71d1a691 100644 --- a/src/runtime_src/core/common/smi/smi.h +++ b/src/runtime_src/core/common/smi/smi.h @@ -30,7 +30,7 @@ struct basic_option { std::string m_type; }; -class XRT_CORE_COMMON_EXPORT option : public basic_option { +class option : public basic_option { std::string m_alias; std::string m_default_value; std::string m_value_type; @@ -76,7 +76,7 @@ class XRT_CORE_COMMON_EXPORT option : public basic_option { // This class is used to represent an option with a multiline description. // For example, --run can have multiple test names as its description. // These subnames are also queried using the generic API get_list -class XRT_CORE_COMMON_EXPORT listable_description_option : public option { +class listable_description_option : public option { std::vector m_description_array; public: listable_description_option(std::string name,