Skip to content

[CI][Packaging][C++][Windows] Snappy patch fails to apply on arm64 windows wheel builds #35503

Description

@sjperkins

Describe the bug, including details regarding any error messages, version, and platform.

#35430 updated the vcpkg version to version 2023.04.15. Snappy patches no longer cleanly apply on arm64 windows wheel builds. See for instance #35430 (comment).

Installing 66/100 snappy:amd64-windows-static-md-release...
Building snappy[core]:amd64-windows-static-md-release...
-- [OVERLAY] Loading triplet configuration from: C:\arrow\ci\vcpkg\amd64-windows-static-md-release.cmake
-- Downloading https://github.com/google/snappy/archive/1.1.9.tar.gz -> google-snappy-1.1.9.tar.gz...
-- Extracting source C:/vcpkg/downloads/google-snappy-1.1.9.tar.gz
-- Applying patch fix_clang-cl_build.patch
-- Applying patch snappy-disable-bmi.patch
CMake Error at scripts/cmake/z_vcpkg_apply_patches.cmake:34 (message):
Applying patch failed: error: corrupt patch at line 18
Call Stack (most recent call first):
scripts/cmake/vcpkg_extract_source_archive.cmake:153 (z_vcpkg_apply_patches)
scripts/cmake/vcpkg_extract_source_archive_ex.cmake:8 (vcpkg_extract_source_archive)
scripts/cmake/vcpkg_from_github.cmake:113 (vcpkg_extract_source_archive_ex)
ports/snappy/portfile.cmake:4 (vcpkg_from_github)
scripts/ports.cmake:147 (include)
error: building snappy:amd64-windows-static-md-release failed with: BUILD_FAILED
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.Then check for known issues at: https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+snappyYou can submit a new issue at: https://github.com/microsoft/vcpkg/issues/new?title=[snappy]+Build+error&body=Copy+issue+body+from+C%3A%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.mdThe command 'cmd /S /C vcpkg install --clean-after-build --x-install-root=%VCPKG_ROOT%\installed --x-manifest-root=arrow/ci/vcpkg --x-feature=flight --x-feature=gcs --x-feature=json --x-feature=parquet' returned a non-zero code: 1Error: docker build --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg python=3.10 --build-arg vcpkg=501db0f17ef6df184fcdbfbe0f87cde2313b6ab1 -f D:\a\crossbow\crossbow\arrow\ci/docker/python-wheel-windows-vs2017.dockerfile -t ghcr.io/ursacomputing/arrow:python-3.10-wheel-windows-vs2017-vcpkg-501db0f17ef6df184fcdbfbe0f87cde2313b6ab1-2022-06-12 D:\a\crossbow\crossbow\arrow exited with non-zero exit code 1

Relevant parts of the patch are here:

vcpkg_cmake_configure(
diff --git a/ports/snappy/snappy-disable-bmi.patch b/ports/snappy/snappy-disable-bmi.patch
new file mode 100644
index 0000000000..a57ce0c22f
--- /dev/null
+++ b/ports/snappy/snappy-disable-bmi.patch
@@ -0,0 +1,19 @@
+diff --git a/snappy.cc b/snappy.cc
+index 79dc0e8..f3153ea 100644
+--- a/snappy.cc
++++ b/snappy.cc
+@@ -965,14 +965,10 @@ static inline void Report(const char *algorithm, size_t compressed_size,
+ static inline uint32_t ExtractLowBytes(uint32_t v, int n) {
+ assert(n >= 0);
+ assert(n <= 4);
+-#if SNAPPY_HAVE_BMI2
+- return _bzhi_u32(v, 8 * n);
+-#else
+ // This needs to be wider than uint32_t otherwise `mask << 32` will be
+ // undefined.
+ uint64_t mask = 0xffffffff;
+ return v & ~(mask << (8 * n));
+-#endif
+ }
+
+ static inline bool LeftShiftOverflows(uint8_t value, uint32_t shift) {

Component(s)

C++, Continuous Integration, Packaging

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions