This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-java.git


The following commit(s) were added to refs/heads/main by this push:
     new 45fa93be0 GH-1408: Add bundled utf8_range headers to the macOS Gandiva 
JNI build (#1409)
45fa93be0 is described below

commit 45fa93be0ee6a90324e5dd0076a098f2dc9a4583
Author: JB Onofré <[email protected]>
AuthorDate: Fri Oct 30 02:01:01 2026 +0000

    GH-1408: Add bundled utf8_range headers to the macOS Gandiva JNI build 
(#1409)
    
    ## What's Changed
    
    The `JNI macos-15 aarch_64` job in the RC workflow fails on `main` with
    `fatal error: 'utf8_validity.h' file not found` while compiling the
    Gandiva JNI library. Apache Arrow C++ `main` now bundles protobuf v36.2
    (previously v31.1), whose `parse_context.h` includes `utf8_validity.h`
    directly. That header is in `third_party/utf8_range` of the bundled
    protobuf source and was not on the include path.
    
    This adds an `ARROW_JAVA_JNI_UTF8_RANGE_INCLUDE_DIR` option, applied to
    the Gandiva JNI target the same way as the bundled Abseil headers, and
    sets it in `jni_macos_build.sh`.
    
    Not tested locally because it needs the full Arrow C++ build. The `JNI
    macos-15 aarch_64` check on this PR is the verification, and a link
    error for the `utf8_range` symbols is possible.
    
    Closes #1408.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    ---------
    
    Co-authored-by: Claude Sonnet 5.5 <[email protected]>
    Co-authored-by: Sutou Kouhei <[email protected]>
---
 .github/workflows/dev.yml      |  2 +-
 CMakeLists.txt                 |  4 ++++
 ci/docker/vcpkg-jni.dockerfile | 10 +++++++++-
 ci/scripts/jni_macos_build.sh  |  8 ++++++++
 gandiva/CMakeLists.txt         |  4 ++++
 5 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index f4dc9ad6f..f649befce 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -42,7 +42,7 @@ jobs:
 
       - uses: actions/setup-python@v7
         with:
-          python-version: '3.x'
+          python-version: '3.14'
       - name: pre-commit (cache)
         uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
         with:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11e6eb744..b6b06d1a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,10 @@ set(ARROW_JAVA_JNI_ABSL_INCLUDE_DIR
     ""
     CACHE PATH "Path to Abseil source headers for the Gandiva JNI build")
 mark_as_advanced(ARROW_JAVA_JNI_ABSL_INCLUDE_DIR)
+set(ARROW_JAVA_JNI_UTF8_RANGE_INCLUDE_DIR
+    ""
+    CACHE PATH "Path to utf8_range source headers for the Gandiva JNI build")
+mark_as_advanced(ARROW_JAVA_JNI_UTF8_RANGE_INCLUDE_DIR)
 
 include(GNUInstallDirs)
 
diff --git a/ci/docker/vcpkg-jni.dockerfile b/ci/docker/vcpkg-jni.dockerfile
index f2f5d0d45..20accd835 100644
--- a/ci/docker/vcpkg-jni.dockerfile
+++ b/ci/docker/vcpkg-jni.dockerfile
@@ -21,7 +21,15 @@ FROM ${base}
 # Install Java
 # We need Java for JNI headers, but we don't invoke Maven in this build.
 ARG java=17
-RUN dnf install -y java-$java-openjdk-devel && dnf clean all
+# The repository metadata is refreshed and the install retried because the
+# baseos mirror intermittently returns an empty repomd.xml.
+RUN dnf clean all && rm -rf /var/cache/dnf && \
+    for i in 1 2 3; do \
+      dnf install -y java-$java-openjdk-devel && break; \
+      if [ "$i" = 3 ]; then exit 1; fi; \
+      sleep 15; \
+    done && \
+    dnf clean all
 
 # For ci/scripts/{cpp,java}_*.sh
 ENV ARROW_HOME=/tmp/local \
diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh
index efc244675..277987aa8 100755
--- a/ci/scripts/jni_macos_build.sh
+++ b/ci/scripts/jni_macos_build.sh
@@ -86,9 +86,17 @@ if [ ! -d "${absl_include_dir}/absl" ]; then
   exit 1
 fi
 
+# Protobuf 33+ headers include utf8_validity.h from the bundled utf8_range.
+utf8_range_include_dir="${build_dir}/cpp/_deps/protobuf-src/third_party/utf8_range"
+if [ ! -f "${utf8_range_include_dir}/utf8_validity.h" ]; then
+  echo "Bundled utf8_range headers were not found in 
${utf8_range_include_dir}" >&2
+  exit 1
+fi
+
 JAVA_JNI_CMAKE_ARGS="-DProtobuf_ROOT=${build_dir}/cpp/_deps/protobuf-build"
 JAVA_JNI_CMAKE_ARGS+=" 
-DProtobuf_SRC_ROOT_FOLDER=${build_dir}/cpp/_deps/protobuf-src"
 JAVA_JNI_CMAKE_ARGS+=" -DARROW_JAVA_JNI_ABSL_INCLUDE_DIR=${absl_include_dir}"
+JAVA_JNI_CMAKE_ARGS+=" 
-DARROW_JAVA_JNI_UTF8_RANGE_INCLUDE_DIR=${utf8_range_include_dir}"
 export JAVA_JNI_CMAKE_ARGS
 "${source_dir}/ci/scripts/jni_build.sh" \
   "${source_dir}" \
diff --git a/gandiva/CMakeLists.txt b/gandiva/CMakeLists.txt
index ca041c9fb..075054778 100644
--- a/gandiva/CMakeLists.txt
+++ b/gandiva/CMakeLists.txt
@@ -58,6 +58,10 @@ if(ARROW_JAVA_JNI_ABSL_INCLUDE_DIR)
   target_include_directories(arrow_java_jni_gandiva SYSTEM
                              PRIVATE "${ARROW_JAVA_JNI_ABSL_INCLUDE_DIR}")
 endif()
+if(ARROW_JAVA_JNI_UTF8_RANGE_INCLUDE_DIR)
+  target_include_directories(arrow_java_jni_gandiva SYSTEM
+                             PRIVATE 
"${ARROW_JAVA_JNI_UTF8_RANGE_INCLUDE_DIR}")
+endif()
 target_link_libraries(arrow_java_jni_gandiva
                       arrow_java_jni_gandiva_headers
                       jni

Reply via email to