From 1eae53a70f83d4c52f58836c1879213aaecec3f9 Mon Sep 17 00:00:00 2001 From: Sammi Chen Date: Mon, 18 May 2026 15:24:48 +0800 Subject: [PATCH 1/4] HDDS-15318. Download libhadoop library during maven build --- .../dev-support/bin/dist-layout-stitching | 18 +++ pom.xml | 121 ++++++++++++++++++ 2 files changed, 139 insertions(+) diff --git a/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching b/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching index 85d347fc6b41..efa33cdf46f8 100755 --- a/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching +++ b/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching @@ -143,6 +143,24 @@ for file in $(find "${ROOT}" -path '*/share/ozone/lib/*jar' | sort); do cp -p "$file" share/ozone/lib/ done +# --------------------------------------------------------- +# Copy Hadoop Native Libraries (libhadoop.so) - Conditionally +# --------------------------------------------------------- +NATIVE_LIBS_DIR="${ROOT}/target/native-lib" + +# Check if the .so files actually exist before attempting to copy +if ls "${NATIVE_LIBS_DIR}"/libhadoop.* 1> /dev/null 2>&1; then + echo "Found Hadoop native libraries. Copying to distribution..." + + # Create the native directory in the final staging area + run mkdir -p ./lib/native + + # Copy the files and symlinks safely + run cp -rP "${NATIVE_LIBS_DIR}/"libhadoop.* ./lib/native +else + echo "Hadoop native libraries not found. Skipping native copy." +fi + #workaround for https://issues.apache.org/jira/browse/MRESOURCES-236 find ./compose -name "*.sh" -exec chmod 755 {} \; find ./kubernetes -name "*.sh" -exec chmod 755 {} \; diff --git a/pom.xml b/pom.xml index d103a35cce29..2583c53160f2 100644 --- a/pom.xml +++ b/pom.xml @@ -2633,5 +2633,126 @@ + + native + + + linux + x86_64 + + + fetch-native-hadoop + + + + + + com.googlecode.maven-download-plugin + download-maven-plugin + 1.6.8 + false + + + fetch-hadoop-native-tar + + wget + + generate-resources + + https://archive.apache.org/dist/hadoop/common/hadoop-${hadoop.version}/hadoop-${hadoop.version}.tar.gz + true + ${project.build.directory}/hadoop-bin + false + false + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 3.1.0 + false + + + + run + + prepare-package + + + + + + + + + + + + + + + + + native-mac + + + mac + aarch64 + + + fetch-native-hadoop + + + + + + com.googlecode.maven-download-plugin + download-maven-plugin + 1.6.8 + false + + + fetch-mac-binary + + wget + + generate-resources + + + https://raw.githubusercontent.com/ChenSammi/ozone-docker-runner/master/hadoop-native-lib/Mac_OS_X-aarch64/${hadoop.version}/libhadoop.1.0.0.dylib + false + ${project.build.directory}/native-lib + false + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 3.1.0 + false + + + + run + + prepare-package + + + + + + + + + + + + + + From b69984c2ae05f3c2068a97cac4a7719b02c411d6 Mon Sep 17 00:00:00 2001 From: Sammi Chen Date: Tue, 19 May 2026 14:34:09 +0800 Subject: [PATCH 2/4] Update hadoop-ozone/dist/dev-support/bin/dist-layout-stitching Co-authored-by: Wei-Chiu Chuang --- hadoop-ozone/dist/dev-support/bin/dist-layout-stitching | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching b/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching index efa33cdf46f8..49900439125b 100755 --- a/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching +++ b/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching @@ -148,7 +148,7 @@ done # --------------------------------------------------------- NATIVE_LIBS_DIR="${ROOT}/target/native-lib" -# Check if the .so files actually exist before attempting to copy +# Check if the libhadoop files actually exist before attempting to copy if ls "${NATIVE_LIBS_DIR}"/libhadoop.* 1> /dev/null 2>&1; then echo "Found Hadoop native libraries. Copying to distribution..." From 62af7c0417e721aca9077cc316eb0b2002d22c99 Mon Sep 17 00:00:00 2001 From: Sammi Chen Date: Tue, 19 May 2026 16:54:05 +0800 Subject: [PATCH 3/4] use mvn property for download-maven-plugin and maven-antrun-plugin version --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 2583c53160f2..d96ddbb3f015 100644 --- a/pom.xml +++ b/pom.xml @@ -2649,7 +2649,7 @@ com.googlecode.maven-download-plugin download-maven-plugin - 1.6.8 + ${download-maven-plugin.version} false @@ -2671,7 +2671,7 @@ org.apache.maven.plugins maven-antrun-plugin - 3.1.0 + ${maven-antrun-plugin.version} false @@ -2710,7 +2710,7 @@ com.googlecode.maven-download-plugin download-maven-plugin - 1.6.8 + ${download-maven-plugin.version} false @@ -2732,7 +2732,7 @@ org.apache.maven.plugins maven-antrun-plugin - 3.1.0 + ${maven-antrun-plugin.version} false From 8aca9a4d8ad4d2de72e9fd7db02c45a3b0a33ba4 Mon Sep 17 00:00:00 2001 From: Sammi Chen Date: Tue, 19 May 2026 23:26:31 +0800 Subject: [PATCH 4/4] download library from ozone-thirdparty --- .../dev-support/bin/dist-layout-stitching | 4 ++-- pom.xml | 23 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching b/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching index 49900439125b..54592ac31986 100755 --- a/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching +++ b/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching @@ -149,14 +149,14 @@ done NATIVE_LIBS_DIR="${ROOT}/target/native-lib" # Check if the libhadoop files actually exist before attempting to copy -if ls "${NATIVE_LIBS_DIR}"/libhadoop.* 1> /dev/null 2>&1; then +if ls "${NATIVE_LIBS_DIR}"/libhadoop* 1> /dev/null 2>&1; then echo "Found Hadoop native libraries. Copying to distribution..." # Create the native directory in the final staging area run mkdir -p ./lib/native # Copy the files and symlinks safely - run cp -rP "${NATIVE_LIBS_DIR}/"libhadoop.* ./lib/native + run cp -rP "${NATIVE_LIBS_DIR}/"libhadoop* ./lib/native else echo "Hadoop native libraries not found. Skipping native copy." fi diff --git a/pom.xml b/pom.xml index d96ddbb3f015..02ba089a81ba 100644 --- a/pom.xml +++ b/pom.xml @@ -2653,17 +2653,16 @@ false - fetch-hadoop-native-tar + fetch-linux-library wget generate-resources - https://archive.apache.org/dist/hadoop/common/hadoop-${hadoop.version}/hadoop-${hadoop.version}.tar.gz - true - ${project.build.directory}/hadoop-bin + https://raw.githubusercontent.com/apache/ozone-thirdparty/master/hadoop-native-lib/${hadoop.version}/libhadoop_linux_x86_64.so + false + ${project.build.directory}/native-lib false - false @@ -2675,16 +2674,16 @@ false + extract-linux-library run prepare-package - - + - + @@ -2714,14 +2713,13 @@ false - fetch-mac-binary + fetch-mac-library wget generate-resources - - https://raw.githubusercontent.com/ChenSammi/ozone-docker-runner/master/hadoop-native-lib/Mac_OS_X-aarch64/${hadoop.version}/libhadoop.1.0.0.dylib + https://raw.githubusercontent.com/apache/ozone-thirdparty/master/hadoop-native-lib/${hadoop.version}/libhadoop_osx_aarch_64.dylib false ${project.build.directory}/native-lib false @@ -2736,6 +2734,7 @@ false + extract-mac-library run @@ -2744,7 +2743,7 @@ - +