Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions recipes/arrow/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ sources:
patches:
"21.0.0":
- patch_file: "patches/21.0.0-0001-fix-downloaded-mimalloc.patch"
patch_description: "use cci package"
patch_type: "conan"
- patch_file: "patches/21.0.0-0002-fix-msvc-arm64.patch"
"20.0.0":
- patch_file: "patches/20.0.0-0001-fix-downloaded-mimalloc.patch"
patch_description: "use cci package"
Expand Down
37 changes: 24 additions & 13 deletions recipes/arrow/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class ArrowConan(ConanFile):
"filesystem_layer": [True, False],
"hdfs_bridgs": [True, False],
"plasma": [True, False, "deprecated"],
"simd_level": [None, "default", "sse4_2", "avx2", "avx512", "neon", ],
"runtime_simd_level": [None, "sse4_2", "avx2", "avx512", "max"],
"simd_level": ["default", "sse4_2", "avx2", "avx512", "neon", "disabled"],
"runtime_simd_level": ["sse4_2", "avx2", "avx512", "max", "disabled"],
"with_backtrace": [True, False],
"with_boost": ["auto", True, False],
"with_csv": [True, False],
Expand Down Expand Up @@ -83,8 +83,8 @@ class ArrowConan(ConanFile):
"filesystem_layer": True,
"hdfs_bridgs": False,
"plasma": "deprecated",
"simd_level": "default",
"runtime_simd_level": "max",
#"simd_level": "default", # see config_options
# "runtime_simd_level": "max", # see config_options
"with_backtrace": False,
"with_boost": True,
"with_brotli": False,
Expand Down Expand Up @@ -134,6 +134,16 @@ def config_options(self):
if Version(self.version) >= "19.0.0":
self.options.with_mimalloc = True

if is_msvc(self) and self.settings.arch == "armv8":
# xsimd does not yet support msvc+arm64
# see: https://github.com/xtensor-stack/xsimd/issues/611
# see: https://github.com/xtensor-stack/xsimd/pull/612
self.options.simd_level = "disabled"
self.options.runtime_simd_level = "disabled"
else:
self.options.simd_level = "default"
self.options.runtime_simd_level = "max"

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
Expand All @@ -153,9 +163,9 @@ def requirements(self):
if self.options.with_jemalloc:
self.requires("jemalloc/5.3.0")
if self.options.with_mimalloc:
self.requires("mimalloc/1.7.6")
self.requires("mimalloc/[>=1.7.6 <3]")
if self.options.with_boost:
self.requires("boost/1.85.0")
self.requires("boost/[>=1.85.0 <=1.88.0]")
if self.options.with_gflags:
self.requires("gflags/2.2.2")
if self.options.with_glog:
Expand All @@ -165,7 +175,7 @@ def requirements(self):
if self.options.with_grpc:
self.requires("grpc/1.50.0")
if self._requires_rapidjson():
self.requires("rapidjson/1.1.0")
self.requires("rapidjson/[>=cci.20230929]")
if self.options.with_llvm:
self.requires("llvm-core/13.0.0")
if self.options.with_openssl:
Expand All @@ -186,9 +196,8 @@ def requirements(self):
self.requires("lz4/1.9.4")
if self.options.with_snappy:
self.requires("snappy/1.1.9")
if self.options.get_safe("simd_level") != None or \
self.options.get_safe("runtime_simd_level") != None:
self.requires("xsimd/13.0.0")
if self.options.simd_level != "disabled" or self.options.runtime_simd_level != "disabled":
self.requires("xsimd/13.0.0")
if self.options.with_zlib:
self.requires("zlib/[>=1.2.11 <2]")
if self.options.with_zstd:
Expand Down Expand Up @@ -339,8 +348,10 @@ def generate(self):
tc.variables["xsimd_SOURCE"] = "SYSTEM"
tc.variables["ARROW_WITH_ZSTD"] = bool(self.options.with_zstd)
tc.variables["zstd_SOURCE"] = "SYSTEM"
tc.variables["ARROW_SIMD_LEVEL"] = str(self.options.simd_level).upper()
tc.variables["ARROW_RUNTIME_SIMD_LEVEL"] = str(self.options.runtime_simd_level).upper()
simd_level = self.options.simd_level
runtime_simd_level = self.options.runtime_simd_level
tc.cache_variables["ARROW_SIMD_LEVEL"] = str(simd_level).upper() if simd_level != "disabled" else "NONE"
tc.cache_variables["ARROW_RUNTIME_SIMD_LEVEL"] = str(runtime_simd_level).upper() if runtime_simd_level != "disabled" else "NONE"
if self.options.with_zstd:
tc.variables["ARROW_ZSTD_USE_SHARED"] = bool(self.dependencies["zstd"].options.shared)
tc.variables["ORC_SOURCE"] = "SYSTEM"
Expand Down Expand Up @@ -546,7 +557,7 @@ def package_info(self):
self.cpp_info.components["libarrow"].requires.append("lz4::lz4")
if self.options.with_snappy:
self.cpp_info.components["libarrow"].requires.append("snappy::snappy")
if self.options.get_safe("simd_level") != None or self.options.get_safe("runtime_simd_level") != None:
if self.options.simd_level != "disabled" or self.options.runtime_simd_level != "disabled":
self.cpp_info.components["libarrow"].requires.append("xsimd::xsimd")
if self.options.with_zlib:
self.cpp_info.components["libarrow"].requires.append("zlib::zlib")
Expand Down
87 changes: 87 additions & 0 deletions recipes/arrow/all/patches/21.0.0-0002-fix-msvc-arm64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
Backport https://github.com/apache/arrow/pull/47779

From 541cba859c3cdb4cc6cb3f456aaae79f67c7d57d Mon Sep 17 00:00:00 2001
From: Jonathan Giannuzzi
Date: Wed, 15 Oct 2025 18:18:00 +0300
Subject: [PATCH] GH-47784: [C++] Patch vendored pcg library to enable msvc
arm64 intrinsics (#47779)

### Rationale for this change

This change enables building Arrow C++ for Windows ARM64 with MSVC when setting `ARROW_SIMD_LEVEL` to `NONE`. This is useful to be able to build Arrow with `vcpkg` and use it as a dependency.

Setting `ARROW_SIMD_LEVEL` to `NONE` is done to disable the use of `xsimd`, which does not yet support msvc arm64 intrinsics, and is non-trivial to fix.

### What changes are included in this PR?

A patch to the vendored `pcg` library, based on https://github.com/imneme/pcg-cpp/pull/99. The upstream pcg library has not been updated in the past 3 years, so this may never get merged.

### Are these changes tested?

Yes, the changes have been tested in https://github.com/microsoft/vcpkg/pull/47750 (the same patch for `vcpkg`, which this change would alleviate) and in https://github.com/jgiannuzzi/ParquetSharp/actions/runs/18354286294 (a full run of the ParquetSharp CI, using this patch to build Arrow with `vcpkg`).

### Are there any user-facing changes?

Not really, unless you consider adding the ability to build Arrow on Windows ARM64 user-facing?
* GitHub Issue: #47784

Authored-by: Jonathan Giannuzzi <jonathan@giannuzzi.me>
Signed-off-by: Antoine Pitrou <antoine@python.org>
---
cpp/src/arrow/vendored/pcg/README.md | 1 +
cpp/src/arrow/vendored/pcg/pcg_uint128.hpp | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/cpp/src/arrow/vendored/pcg/README.md b/cpp/src/arrow/vendored/pcg/README.md
index b58504f3b37..7a949723dad 100644
--- a/cpp/src/arrow/vendored/pcg/README.md
+++ b/cpp/src/arrow/vendored/pcg/README.md
@@ -25,4 +25,5 @@ Sources are taken from git changeset ffd522e7188bef30a00c74dc7eb9de5faff90092
Changes:
- enclosed in `arrow_vendored` namespace
- remove `struct arbitrary_seed` definition because of https://github.com/apache/arrow/issues/35596
+- enable MSVC ARM64 intrinsics to allow building on Windows ARM64 with Visual Studio - see https://github.com/apache/arrow/pull/47779

diff --git a/cpp/src/arrow/vendored/pcg/pcg_uint128.hpp b/cpp/src/arrow/vendored/pcg/pcg_uint128.hpp
index 0181e69e4ef..012f3d66823 100644
--- a/cpp/src/arrow/vendored/pcg/pcg_uint128.hpp
+++ b/cpp/src/arrow/vendored/pcg/pcg_uint128.hpp
@@ -67,7 +67,7 @@
#define PCG_LITTLE_ENDIAN 1
#elif __BIG_ENDIAN__ || _BIG_ENDIAN
#define PCG_LITTLE_ENDIAN 0
- #elif __x86_64 || __x86_64__ || _M_X64 || __i386 || __i386__ || _M_IX86
+ #elif __x86_64 || __x86_64__ || _M_X64 || __i386 || __i386__ || _M_IX86 || _M_ARM64
#define PCG_LITTLE_ENDIAN 1
#elif __powerpc__ || __POWERPC__ || __ppc__ || __PPC__ \
|| __m68k__ || __mc68000__
@@ -734,7 +734,13 @@ uint_x4<UInt,UIntX2> operator*(const uint_x4<UInt,UIntX2>& a,

#if PCG_64BIT_SPECIALIZATIONS
#if defined(_MSC_VER)
+#if defined(_M_X64) || defined(_M_IX86)
#pragma intrinsic(_umul128)
+#elif defined(_M_ARM64)
+#pragma intrinsic(__umulh)
+#else
+#error Unsupported architecture
+#endif
#endif

#if defined(_MSC_VER) || __SIZEOF_INT128__
@@ -743,8 +749,15 @@ uint_x4<UInt32,uint64_t> operator*(const uint_x4<UInt32,uint64_t>& a,
const uint_x4<UInt32,uint64_t>& b)
{
#if defined(_MSC_VER)
+#if defined(_M_X64) || defined(_M_IX86)
uint64_t hi;
uint64_t lo = _umul128(a.d.v01, b.d.v01, &hi);
+#elif defined(_M_ARM64)
+ uint64_t lo = a.d.v01 * b.d.v01;
+ uint64_t hi = __umulh(a.d.v01, b.d.v01);
+#else
+#error Unsupported architecture
+#endif
#else
__uint128_t r = __uint128_t(a.d.v01) * __uint128_t(b.d.v01);
uint64_t lo = uint64_t(r);
2 changes: 1 addition & 1 deletion recipes/thrift/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("boost/1.85.0", transitive_headers=True)
self.requires("boost/[>=1.85.0 <=1.88.0]", transitive_headers=True)
if self.options.with_openssl:
self.requires("openssl/[>=1.1 <4]")
if self.options.with_zlib:
Expand Down