From 8b6d8e034c8d1ef1848cfb50b3319345a9c3ff30 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Oct 2025 21:07:01 +0000 Subject: [PATCH 1/2] Initial plan From 691345ba8c5b3b9250cc2bc2b3aa58a0f205542a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Oct 2025 21:14:06 +0000 Subject: [PATCH 2/2] Fix OCI build failure on Windows ARM64 with clang Co-authored-by: ericcurtin <1694275+ericcurtin@users.noreply.github.com> --- common/CMakeLists.txt | 3 +++ common/patch_liboci_header.cmake | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 common/patch_liboci_header.cmake diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 5cc35b531bb23..1a175a208e413 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -120,6 +120,9 @@ if (GO_EXECUTABLE AND GO_VERSION_OK) add_custom_command( OUTPUT ${OCI_LIB} ${OCI_HEADER} COMMAND ${GO_EXECUTABLE} build -buildmode=c-archive -o ${OCI_LIB} ${OCI_GO_DIR}/oci.go + # Patch the generated header to fix clang compatibility on Windows + COMMAND ${CMAKE_COMMAND} -E echo "Patching liboci.h for clang compatibility" + COMMAND ${CMAKE_COMMAND} -DHEADER_FILE=${OCI_HEADER} -P ${CMAKE_CURRENT_SOURCE_DIR}/patch_liboci_header.cmake WORKING_DIRECTORY ${OCI_GO_DIR} DEPENDS ${OCI_GO_DIR}/oci.go ${OCI_GO_DIR}/go.mod COMMENT "Building OCI Go library" diff --git a/common/patch_liboci_header.cmake b/common/patch_liboci_header.cmake new file mode 100644 index 0000000000000..5c88b4ae7737f --- /dev/null +++ b/common/patch_liboci_header.cmake @@ -0,0 +1,29 @@ +# Patch liboci.h to fix clang compatibility on Windows +# This script is called by CMakeLists.txt after Go generates the header + +if(NOT DEFINED HEADER_FILE) + message(FATAL_ERROR "HEADER_FILE not defined") +endif() + +if(NOT EXISTS "${HEADER_FILE}") + message(FATAL_ERROR "Header file does not exist: ${HEADER_FILE}") +endif() + +# Read the header file +file(READ "${HEADER_FILE}" HEADER_CONTENT) + +# Replace the problematic section +# The issue is that clang on Windows defines _MSC_VER but doesn't support _Fcomplex/_Dcomplex +# We need to check for __clang__ and use C++ complex types in that case + +string(REPLACE + "#ifdef _MSC_VER\n#if !defined(__cplusplus) || _MSVC_LANG <= 201402L\n#include \ntypedef _Fcomplex GoComplex64;\ntypedef _Dcomplex GoComplex128;\n#else\n#include \ntypedef std::complex GoComplex64;\ntypedef std::complex GoComplex128;\n#endif" + "#ifdef _MSC_VER\n#if defined(__clang__) || (defined(__cplusplus) && _MSVC_LANG > 201402L)\n#include \ntypedef std::complex GoComplex64;\ntypedef std::complex GoComplex128;\n#elif !defined(__cplusplus) || _MSVC_LANG <= 201402L\n#include \ntypedef _Fcomplex GoComplex64;\ntypedef _Dcomplex GoComplex128;\n#else\n#include \ntypedef std::complex GoComplex64;\ntypedef std::complex GoComplex128;\n#endif" + HEADER_CONTENT + "${HEADER_CONTENT}" +) + +# Write the patched header back +file(WRITE "${HEADER_FILE}" "${HEADER_CONTENT}") + +message(STATUS "Successfully patched ${HEADER_FILE}")