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

weichiu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 66705728573 HDDS-13877. Fix and tweak Apple silicon protobuf 2.5.0 
build section (#9242)
66705728573 is described below

commit 667057285730c2c85ba6835b11177c9b477c0790
Author: Siyao Meng <[email protected]>
AuthorDate: Wed Dec 10 21:29:46 2025 -0800

    HDDS-13877. Fix and tweak Apple silicon protobuf 2.5.0 build section (#9242)
---
 hadoop-hdds/docs/content/start/FromSource.md | 37 ++++++++++++++++++----------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/hadoop-hdds/docs/content/start/FromSource.md 
b/hadoop-hdds/docs/content/start/FromSource.md
index 82ee51027a7..758ac39e80f 100644
--- a/hadoop-hdds/docs/content/start/FromSource.md
+++ b/hadoop-hdds/docs/content/start/FromSource.md
@@ -66,29 +66,40 @@ mvn install:install-file -DgroupId=com.google.protobuf 
-DartifactId=protoc -Dver
 cp 
$HOME/.m2/repository/com/google/protobuf/protoc/2.5.0/protoc-2.5.0-linux-aarch_64
 
$HOME/.m2/repository/com/google/protobuf/protoc/2.5.0/protoc-2.5.0-linux-aarch_64.exe
 ```
 
-## ARM-based Apple Silicon (Apple M1 ... etc)
+## ARM-based Apple silicon (Apple M1, M2, etc.)
 
 ```bash
 # Patch protobuf 2.5.0 - this is needed for Hadoop 2 support
-PROTOBUF_VERSION="2.5.0"
 curl -LO 
https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
 tar xzf protobuf-2.5.0.tar.gz
-pushd protobuf-${PROTOBUF_VERSION}
-
-# Open the file `src/google/protobuf/stubs/platform_macros.h` with an editor 
like vim and append the following lines after line 59 (include the #).  
-# Save the file when complete.
-
-#elif defined(__arm64__)
-#define GOOGLE_PROTOBUF_ARCH_ARM 1
-#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
+pushd protobuf-2.5.0
+
+# Patch to insert arm64 macro
+patch -p1 << EOF
+diff --git a/src/google/protobuf/stubs/platform_macros.h 
b/src/google/protobuf/stubs/platform_macros.h
+index b1df60e..8a68655 100644
+--- a/src/google/protobuf/stubs/platform_macros.h
++++ b/src/google/protobuf/stubs/platform_macros.h
+@@ -57,6 +57,9 @@
+ #elif defined(__ppc__)
+ #define GOOGLE_PROTOBUF_ARCH_PPC 1
+ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
++#elif defined(__arm64__)
++#define GOOGLE_PROTOBUF_ARCH_ARM 1
++#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
+ #else
+ #error Host architecture was not detected as supported by protobuf
+ #endif
+EOF
 
 # Execute the following commands to build `protoc`
 ./configure --disable-shared
 make -j
+
 # Install protoc to the local Maven repository
-mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc 
-Dversion=${PROTOBUF_VERSION} -Dclassifier=osx-aarch_64 -Dpackaging=exe 
-Dfile=src/protoc
-# Workaround for Maven 3.9.x. Not needed for 3.8.x or earlier
-mv 
$HOME/.m2/repository/com/google/protobuf/protoc/${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-osx-aarch_64
 
$HOME/.m2/repository/com/google/protobuf/protoc/${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-osx-aarch_64.exe
+mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc 
-Dversion=2.5.0 -Dclassifier=osx-aarch_64 -Dpackaging=exe -Dfile=src/protoc
+# Workaround for Maven 3.9.x. Not needed for 3.8.x and earlier
+mv 
$HOME/.m2/repository/com/google/protobuf/protoc/2.5.0/protoc-2.5.0-osx-aarch_64 
$HOME/.m2/repository/com/google/protobuf/protoc/2.5.0/protoc-2.5.0-osx-aarch_64.exe
 popd
 ```
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to