From c5723d1a2358854f65b57541ff48c67385397c49 Mon Sep 17 00:00:00 2001 From: James Duong Date: Fri, 19 Jan 2024 11:47:10 -0800 Subject: [PATCH] PR suggestions Remove explicit setting of ARROW_JAVA_JNI_ARCH_DIR in build system. Clarify that this should get auto-detected. --- ci/scripts/java_jni_build.sh | 2 +- ci/scripts/java_jni_manylinux_build.sh | 1 - ci/scripts/java_jni_windows_build.sh | 1 - docs/source/developers/java/building.rst | 6 ------ java/CMakeLists.txt | 13 +++++++------ java/pom.xml | 5 ----- 6 files changed, 8 insertions(+), 20 deletions(-) diff --git a/ci/scripts/java_jni_build.sh b/ci/scripts/java_jni_build.sh index cbb754b3e4822..d989351ab7e4d 100755 --- a/ci/scripts/java_jni_build.sh +++ b/ci/scripts/java_jni_build.sh @@ -55,7 +55,7 @@ cmake \ -DBUILD_TESTING=${ARROW_JAVA_BUILD_TESTS} \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ -DCMAKE_PREFIX_PATH=${arrow_install_dir} \ -\ -DCMAKE_INSTALL_PREFIX=${prefix_dir} \ + -DCMAKE_INSTALL_PREFIX=${prefix_dir} \ -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD:-OFF} \ -DProtobuf_USE_STATIC_LIBS=ON \ -GNinja \ diff --git a/ci/scripts/java_jni_manylinux_build.sh b/ci/scripts/java_jni_manylinux_build.sh index 572cc79a23207..da4987d307ce4 100755 --- a/ci/scripts/java_jni_manylinux_build.sh +++ b/ci/scripts/java_jni_manylinux_build.sh @@ -91,7 +91,6 @@ cmake \ -DARROW_S3=${ARROW_S3} \ -DARROW_USE_CCACHE=${ARROW_USE_CCACHE} \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ - -DARROW_JAVA_JNI_ARCH_DIR=${normalized_arch} \ -DCMAKE_INSTALL_PREFIX=${ARROW_HOME} \ -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} \ -DGTest_SOURCE=BUNDLED \ diff --git a/ci/scripts/java_jni_windows_build.sh b/ci/scripts/java_jni_windows_build.sh index b0916a9eb8be4..39288f4a9d0ce 100755 --- a/ci/scripts/java_jni_windows_build.sh +++ b/ci/scripts/java_jni_windows_build.sh @@ -72,7 +72,6 @@ cmake \ -DARROW_WITH_SNAPPY=ON \ -DARROW_WITH_ZSTD=ON \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ - -DARROW_JAVA_JNI_ARCH_DIR=x86_64 \ -DCMAKE_INSTALL_PREFIX=${install_dir} \ -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} \ -GNinja \ diff --git a/docs/source/developers/java/building.rst b/docs/source/developers/java/building.rst index 6e17b948834b9..27e2de97328c3 100644 --- a/docs/source/developers/java/building.rst +++ b/docs/source/developers/java/building.rst @@ -165,7 +165,6 @@ CMake -DARROW_JAVA_JNI_ENABLE_DEFAULT=OFF \ -DBUILD_TESTING=OFF \ -DCMAKE_BUILD_TYPE=Release \ - -DARROW_JAVA_JNI_ARCH_DIR= \ -DCMAKE_INSTALL_PREFIX=java-dist $ cmake --build java-cdata --target install --config Release $ ls -latr java-dist/lib @@ -184,7 +183,6 @@ CMake -DARROW_JAVA_JNI_ENABLE_DEFAULT=OFF ^ -DBUILD_TESTING=OFF ^ -DCMAKE_BUILD_TYPE=Release ^ - -DARROW_JAVA_JNI_ARCH_DIR=x86_64 ^ -DCMAKE_INSTALL_PREFIX=java-dist $ cmake --build java-cdata --target install --config Release $ dir "java-dist/bin" @@ -220,7 +218,6 @@ CMake -DARROW_SUBSTRAIT=ON \ -DARROW_USE_CCACHE=ON \ -DCMAKE_BUILD_TYPE=Release \ - -DARROW_JAVA_JNI_ARCH_DIR= \ -DCMAKE_INSTALL_PREFIX=java-dist \ -DCMAKE_UNITY_BUILD=ON $ cmake --build cpp-jni --target install --config Release @@ -231,7 +228,6 @@ CMake -DARROW_JAVA_JNI_ENABLE_DEFAULT=ON \ -DBUILD_TESTING=OFF \ -DCMAKE_BUILD_TYPE=Release \ - -DARROW_JAVA_JNI_ARCH_DIR= \ -DCMAKE_INSTALL_PREFIX=java-dist \ -DCMAKE_PREFIX_PATH=$PWD/java-dist \ -DProtobuf_ROOT=$PWD/../cpp-jni/protobuf_ep-install \ @@ -269,7 +265,6 @@ CMake -DARROW_WITH_ZLIB=ON ^ -DARROW_WITH_ZSTD=ON ^ -DCMAKE_BUILD_TYPE=Release ^ - -DARROW_JAVA_JNI_ARCH_DIR=x86_64 ^ -DCMAKE_INSTALL_PREFIX=java-dist ^ -DCMAKE_UNITY_BUILD=ON ^ -GNinja @@ -286,7 +281,6 @@ CMake -DARROW_JAVA_JNI_ENABLE_ORC=ON ^ -DBUILD_TESTING=OFF ^ -DCMAKE_BUILD_TYPE=Release ^ - -DARROW_JAVA_JNI_ARCH_DIR=x86_64 ^ -DCMAKE_INSTALL_PREFIX=java-dist ^ -DCMAKE_PREFIX_PATH=$PWD/java-dist $ cmake --build java-jni --target install --config Release diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index e4c4dfd95fb00..2389c183cfd08 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -74,17 +74,18 @@ if(BUILD_TESTING) GTest::gtest_main) endif() -# If the user hasn't set ARROW_JAVA_JNI_ARCH_DIR, derive the normalized -# operating system from the host processor. +# The ARROW_JAVA_JNI_ARCH_DIR will automatically be derived the normalized +# operating system from system processor. The user can override this variable +# if auto-detection fails. if("${ARROW_JAVA_JNI_ARCH_DIR}" STREQUAL "") - if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "aarch64") + if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64") set(ARROW_JAVA_JNI_ARCH_DIR "aarch_64") - elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "i386") + elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386") set(ARROW_JAVA_JNI_ARCH_DIR "x86_64") - elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64") + elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64") set(ARROW_JAVA_JNI_ARCH_DIR "aarch_64") else() - set(ARROW_JAVA_JNI_ARCH_DIR "${CMAKE_HOST_SYSTEM_PROCESSOR}") + set(ARROW_JAVA_JNI_ARCH_DIR "${CMAKE_SYSTEM_PROCESSOR}") endif() endif() diff --git a/java/pom.xml b/java/pom.xml index 4bef553e58b7d..6fc4df67af3e7 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -1055,7 +1055,6 @@ -DARROW_JAVA_JNI_ENABLE_DEFAULT=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release - -DARROW_JAVA_JNI_ARCH_DIR=${os.detected.arch} -DCMAKE_INSTALL_PREFIX=${arrow.c.jni.dist.dir} ../ @@ -1128,7 +1127,6 @@ -DARROW_SUBSTRAIT=${ARROW_DATASET} -DARROW_USE_CCACHE=ON -DCMAKE_BUILD_TYPE=Release - -DARROW_JAVA_JNI_ARCH_DIR=${os.detected.arch} -DCMAKE_INSTALL_PREFIX=java-dist -DCMAKE_UNITY_BUILD=ON @@ -1169,7 +1167,6 @@ -DARROW_JAVA_JNI_ENABLE_DEFAULT=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release - -DARROW_JAVA_JNI_ARCH_DIR=${os.detected.arch} -DCMAKE_INSTALL_PREFIX=${arrow.dataset.jni.dist.dir} -DCMAKE_PREFIX_PATH=${project.basedir}/../java-dist/lib/${os.detected.arch}/cmake -DProtobuf_USE_STATIC_LIBS=ON @@ -1248,7 +1245,6 @@ -DARROW_WITH_ZLIB=ON -DARROW_WITH_ZSTD=ON -DCMAKE_BUILD_TYPE=Release - -DARROW_JAVA_JNI_ARCH_DIR=${os.detected.arch} -DCMAKE_INSTALL_PREFIX=java-dist -DCMAKE_UNITY_BUILD=ON -GNinja @@ -1290,7 +1286,6 @@ -DARROW_JAVA_JNI_ENABLE_DEFAULT=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release - -DARROW_JAVA_JNI_ARCH_DIR=${os.detected.arch} -DCMAKE_INSTALL_PREFIX=${arrow.dataset.jni.dist.dir} -DCMAKE_PREFIX_PATH=${project.basedir}/../java-dist/lib/${os.detected.arch}/cmake