From bc9567985b04336fbf908ed20bb40b308e614322 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Tue, 3 Nov 2026 17:12:50 +0100 Subject: [PATCH 1/3] Remove protobuf patch --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 17 --------- cpp/cmake_modules/protobuf-emscripten.patch | 39 --------------------- 2 files changed, 56 deletions(-) delete mode 100644 cpp/cmake_modules/protobuf-emscripten.patch diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 40343415b361..123def5b66c5 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -2060,25 +2060,8 @@ function(build_protobuf) "${PROTOBUF_INCLUDE_DIR}" PARENT_SCOPE) - set(PROTOBUF_PATCH_COMMAND) - if(EMSCRIPTEN) - find_program(PATCH patch) - if(PATCH) - set(PROTOBUF_PATCH_COMMAND ${PATCH} -p1 -i) - else() - find_program(GIT git) - if(GIT) - set(PROTOBUF_PATCH_COMMAND ${GIT} apply) - endif() - endif() - if(PROTOBUF_PATCH_COMMAND) - list(APPEND PROTOBUF_PATCH_COMMAND - ${CMAKE_CURRENT_LIST_DIR}/protobuf-emscripten.patch) - endif() - endif() fetchcontent_declare(protobuf ${FC_DECLARE_COMMON_OPTIONS} OVERRIDE_FIND_PACKAGE - PATCH_COMMAND ${PROTOBUF_PATCH_COMMAND} URL ${PROTOBUF_SOURCE_URL} URL_HASH "SHA256=${ARROW_PROTOBUF_BUILD_SHA256_CHECKSUM}") diff --git a/cpp/cmake_modules/protobuf-emscripten.patch b/cpp/cmake_modules/protobuf-emscripten.patch deleted file mode 100644 index 650af873ee17..000000000000 --- a/cpp/cmake_modules/protobuf-emscripten.patch +++ /dev/null @@ -1,39 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - ---- a/src/google/protobuf/port_def.inc -+++ b/src/google/protobuf/port_def.inc -@@ -435,13 +435,15 @@ - # endif - #else --# if defined(__cpp_constinit) && !defined(__CYGWIN__) -+// Emscripten's libc++ std::string is not constexpr-constructible (heap alloc). -+# if defined(__cpp_constinit) && !defined(__CYGWIN__) && !defined(__EMSCRIPTEN__) - # define PROTOBUF_CONSTINIT constinit - # define PROTOBUF_CONSTEXPR constexpr - # define PROTOBUF_CONSTINIT_DEFAULT_INSTANCES - // Some older Clang versions incorrectly raise an error about - // constant-initializing weak default instance pointers. Versions 12.0 and - // higher seem to work, except that XCode 12.5.1 shows the error even though it - // uses Clang 12.0.5. --#elif !defined(__CYGWIN__) && !defined(__MINGW32__) && \ -+#elif !defined(__CYGWIN__) && !defined(__MINGW32__) && \ -+ !defined(__EMSCRIPTEN__) && \ - ABSL_HAVE_CPP_ATTRIBUTE(clang::require_constant_initialization) && \ - ((defined(__APPLE__) && PROTOBUF_CLANG_MIN(13, 0)) || \ - (!defined(__APPLE__) && PROTOBUF_CLANG_MIN(12, 0))) From 014f1de73bc06f68c61eb200d94f3baf64bb17fc Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Tue, 3 Nov 2026 20:26:21 +0100 Subject: [PATCH 2/3] StrptimeParser fix for preexisting arrow-utility-test failure --- cpp/src/arrow/util/value_parsing.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/util/value_parsing.h b/cpp/src/arrow/util/value_parsing.h index d845a71cf1f8..ee1be30af390 100644 --- a/cpp/src/arrow/util/value_parsing.h +++ b/cpp/src/arrow/util/value_parsing.h @@ -799,7 +799,7 @@ static inline bool ParseTimestampISO8601(const char* s, size_t length, return true; } -#if defined(_WIN32) || defined(ARROW_WITH_MUSL) +#if defined(_WIN32) || defined(__EMSCRIPTEN__) || defined(ARROW_WITH_MUSL) static constexpr bool kStrptimeSupportsZone = false; #else static constexpr bool kStrptimeSupportsZone = true; @@ -818,7 +818,9 @@ static inline bool ParseTimestampStrptime(const char* buf, size_t length, // Default the day to the first for formats without a day directive, so that // an explicitly parsed zero day is not mistaken for an omitted one result.tm_mday = 1; -#ifdef _WIN32 +#if defined(_WIN32) || defined(__EMSCRIPTEN__) + // Emscripten's strptime() normalizes out-of-range fields through a JavaScript + // Date (e.g. February 30 becomes March 1), which defeats the checks below char* ret = arrow_strptime(clean_copy.c_str(), format, &result); #else char* ret = strptime(clean_copy.c_str(), format, &result); From 9147cc79166652b40a5c731061a25e474eca5d8f Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Tue, 3 Nov 2026 21:50:44 +0100 Subject: [PATCH 3/3] Fix new Abseil bump arrow-substrait-substrait-test failure --- cpp/cmake_modules/SetupCxxFlags.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 750e3bef29c0..350eda322e11 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -747,6 +747,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") "${ARROW_EMSCRIPTEN_LINKER_FLAGS} -sERROR_ON_WASM_CHANGES_AFTER_LINK=1 -sSTACK_SIZE=${ARROW_EMSCRIPTEN_TEST_STACK_SIZE} -sALLOW_MEMORY_GROWTH -lnodefs.js -lnoderawfs.js --pre-js ${BUILD_SUPPORT_DIR}/emscripten-test-init.js" ) endif() + # Abseil stack trace via emscripten_stack_snapshot() abort on Emscripten<4.0.14 + # if offset converter isn't enabled. Emscripten 4.0.14 removed the offset converter + if(EMSCRIPTEN_VERSION VERSION_LESS "4.0.14") + string(APPEND CMAKE_EXE_LINKER_FLAGS " -sUSE_OFFSET_CONVERTER=1") + endif() else() set(CMAKE_EXE_LINKER_FLAGS "${ARROW_EMSCRIPTEN_LINKER_FLAGS} -sALLOW_MEMORY_GROWTH") endif()