Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for cross-compiling for ppc64le platform #9284

Merged
merged 13 commits into from Jun 23, 2022
4 changes: 4 additions & 0 deletions buildscripts/kokoro/linux_artifacts.sh
Expand Up @@ -49,3 +49,7 @@ cp -r "$LOCAL_MVN_TEMP"/* "$MVN_ARTIFACT_DIR"/
# for aarch64 platform
sudo apt-get install -y g++-aarch64-linux-gnu
SKIP_TESTS=true ARCH=aarch_64 "$GRPC_JAVA_DIR"/buildscripts/kokoro/unix.sh

# for ppc64le platform
sudo apt-get install -y g++-10-powerpc64-linux-gnu
SKIP_TESTS=true ARCH=ppcle_64 "$GRPC_JAVA_DIR"/buildscripts/kokoro/unix.sh
4 changes: 4 additions & 0 deletions buildscripts/kokoro/unix.sh
Expand Up @@ -90,6 +90,10 @@ if [[ -z "${ALL_ARTIFACTS:-}" ]]; then
GRADLE_FLAGS+=" -x grpc-compiler:generateTestProto -x grpc-compiler:generateTestLiteProto"
GRADLE_FLAGS+=" -x grpc-compiler:testGolden -x grpc-compiler:testLiteGolden"
GRADLE_FLAGS+=" -x grpc-compiler:testDeprecatedGolden -x grpc-compiler:testDeprecatedLiteGolden"
elif [[ $ARCH == "ppcle_64" ]]; then
sumitd2 marked this conversation as resolved.
Show resolved Hide resolved
GRADLE_FLAGS+=" -x grpc-compiler:generateTestProto -x grpc-compiler:generateTestLiteProto"
GRADLE_FLAGS+=" -x grpc-compiler:testGolden -x grpc-compiler:testLiteGolden"
GRADLE_FLAGS+=" -x grpc-compiler:testDeprecatedGolden -x grpc-compiler:testDeprecatedLiteGolden"
fi
./gradlew grpc-compiler:build grpc-compiler:publish $GRADLE_FLAGS \
-Dorg.gradle.parallel=false -PrepositoryDir=$LOCAL_MVN_TEMP
Expand Down
3 changes: 3 additions & 0 deletions buildscripts/kokoro/upload_artifacts.sh
Expand Up @@ -34,6 +34,9 @@ LOCAL_OTHER_ARTIFACTS="$KOKORO_GFILE_DIR"/github/grpc-java/artifacts/
# for linux aarch64 platform
[[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-linux-aarch_64.exe' | wc -l)" != '0' ]]

# for linux ppc64le platform
[[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-linux-ppcle_64.exe' | wc -l)" != '0' ]]

# from macos job:
[[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-osx-x86_64.exe' | wc -l)" != '0' ]]
# copy all x86 artifacts to aarch until native artifacts are built
Expand Down
2 changes: 2 additions & 0 deletions buildscripts/make_dependencies.sh
Expand Up @@ -36,6 +36,8 @@ else
--prefix="$INSTALL_DIR"
elif [[ "$ARCH" == aarch* ]]; then
./configure --disable-shared --host=aarch64-linux-gnu --prefix="$INSTALL_DIR"
elif [[ "$ARCH" == ppc* ]]; then
./configure --disable-shared --host=ppc64le-linux-gnu --prefix="$INSTALL_DIR"
fi
# the same source dir is used for 32 and 64 bit builds, so we need to clean stale data first
make clean
Expand Down
5 changes: 4 additions & 1 deletion compiler/build.gradle
Expand Up @@ -50,7 +50,10 @@ model {
}
}
gcc(Gcc) {
target("ppcle_64")
target("ppcle_64") {
cppCompiler.executable = 'powerpc64-linux-gnu-g++-10'
linker.executable = 'powerpc64-linux-gnu-g++-10'
}
target("aarch_64") {
cppCompiler.executable = 'aarch64-linux-gnu-g++'
linker.executable = 'aarch64-linux-gnu-g++'
Expand Down
4 changes: 4 additions & 0 deletions compiler/check-artifact.sh
Expand Up @@ -61,6 +61,8 @@ checkArch ()
assertEq "$format" "elf64-x86-64" $LINENO
elif [[ "$ARCH" == aarch_64 ]]; then
assertEq "$format" "elf64-little" $LINENO
elif [[ "$ARCH" == ppcle_64 ]]; then
assertEq "$format" "elf64-powerpcle" $LINENO
else
fail "Unsupported arch: $ARCH"
fi
Expand Down Expand Up @@ -108,6 +110,8 @@ checkDependencies ()
elif [[ "$ARCH" == aarch_64 ]]; then
dump_cmd='aarch64-linux-gnu-objdump -x '"$1"' |grep "NEEDED"'
white_list="linux-vdso\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux-aarch64\.so\.1"
elif [[ "$ARCH" == ppcle_64 ]]; then
white_list="linux-vdso64\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld64\.so\.2\|libstdc++\.so\.6\|libgcc_s\.so\.1"
sumitd2 marked this conversation as resolved.
Show resolved Hide resolved
fi
elif [[ "$OS" == osx ]]; then
dump_cmd='otool -L '"$1"' | fgrep dylib'
Expand Down