fmorg-git commented on code in PR #154: URL: https://github.com/apache/ozone-site/pull/154#discussion_r2412252038
########## docs/08-developer-guide/01-build/01-maven.md: ########## @@ -45,6 +45,116 @@ Choose one of the following methods to get the source code: Apache Ozone uses [Maven](https://maven.apache.org/) as its build system. The build process compiles the source code, runs tests, and creates deployable artifacts. The project supports various build configurations to accommodate different development and deployment needs. +### Additional Steps Required For ARM-based Apple Silicon Macs (M1, etc) + +If you are running on an ARM-based Apple Silicon Mac, please perform the additional steps in this section. + +#### Prerequisites + +- [Gradle](https://gradle.org/) - Gradle 7.0 or higher +- [Compatible JVM for gRPC Java v1.71.0](https://github.com/grpc/grpc-java/blob/v1.71.0/README.md) - Compatible JVM for gRPC and Gradle + +#### Compile Protobuf version 3.7.1 for ARM-based Mac + +Execute the following commands to compile Protobuf version 3.7.1: + +```bash +PROTOBUF_VERSION="3.7.1" +curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-all-${PROTOBUF_VERSION}.tar.gz | tar zx +cd protobuf-${PROTOBUF_VERSION} +./configure --disable-shared +make -j +``` + +Execute the following command to install `protoc` version 3.7.1 to the local Maven repository: + +```bash +mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=${PROTOBUF_VERSION} -Dclassifier=osx-aarch_64 -Dpackaging=exe -Dfile=src/protoc +``` + +If you are running Maven 3.9.x or higher, execute the following command. This command is not needed for 3.8.x or earlier: + +```bash +cp $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 +``` + +#### Compile and Patch Protobuf version 2.5.0 for ARM-based Mac + +Execute the following commands to compile and patch Protobuf version 2.5.0: + +```bash +cd .. +PROTOBUF_VERSION="2.5.0" +curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-${PROTOBUF_VERSION}.tar.gz | tar zx +cd protobuf-${PROTOBUF_VERSION} +curl -L -O https://gist.githubusercontent.com/liusheng/64aee1b27de037f8b9ccf1873b82c413/raw/118c2fce733a9a62a03281753572a45b6efb8639/protobuf-2.5.0-arm64.patch +patch -p1 < protobuf-2.5.0-arm64.patch +./configure --disable-shared +make +``` + +Execute the following command to install `protoc` version 2.5.0 to the local Maven repository: + +```bash +mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=${PROTOBUF_VERSION} -Dclassifier=osx-aarch_64 -Dpackaging=exe -Dfile=src/protoc +``` + +If you are running Maven 3.9.x or higher, execute the following command. This command is not needed for 3.8.x or earlier: + +```bash +cp $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 +``` + +#### Compile Protobuf version 3.19.6 for ARM-based Mac + +Execute the following commands to compile Protobuf version 3.19.6: + +```bash +cd .. +PROTOBUF_VERSION="3.19.6" +curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-all-${PROTOBUF_VERSION}.tar.gz +tar xzf protobuf-all-${PROTOBUF_VERSION}.tar.gz +cd protobuf-${PROTOBUF_VERSION} +./configure --disable-shared +make -j +``` + +Execute the following command to install `protoc` version 3.19.6 to the local Maven repository: + +```bash +mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=${PROTOBUF_VERSION} -Dclassifier=osx-aarch_64 -Dpackaging=exe -Dfile=src/protoc +``` + +If you are running Maven 3.9.x or higher, execute the following command. This command is not needed for 3.8.x or earlier: + +```bash +cp $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 +``` + +#### Compile gRPC version 1.71.0 for ARM-based Mac Review Comment: Per above, it didn't work for me the first time I tried and it was giving me error related the architecture. Fortunately, I pasted the error in the Slack thread: ``` ozone/hadoop-hdds/interface-client/target/protoc-plugins/protoc-gen-grpc-java-1.71.0-osx-aarch_64.exe: program not found or is not executable Please specify a program using absolute path or make sure the program is available in your PATH system variable --grpc-java_out: protoc-gen-grpc-java: Plugin failed with status code 1. ``` Not sure if something was changed since the first time I tried it, but I didn't have that problem today. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
