Changed RPI build test to general ARM build test (#25580)

* Change rpi build test to arm test
* Having a separate docker and targetting aarch64
pull/25567/head
Esun Kim 4 years ago committed by GitHub
parent fcd43e9030
commit 160cb1b215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      BUILDING.md
  2. 51
      test/distrib/cpp/run_distrib_test_cmake_aarch64_cross.sh
  3. 29
      tools/dockerfile/distribtest/cpp_stretch_aarch64_cross_x64/Dockerfile
  4. 3
      tools/run_tests/artifacts/distribtest_targets.py

@ -243,7 +243,7 @@ $ cmake ../.. -DCMAKE_TOOLCHAIN_FILE=path/to/file
$ make
```
[Cross-compile example](test/distrib/cpp/run_distrib_test_raspberry_pi.sh)
[Cross-compile example](test/distrib/cpp/run_distrib_test_cmake_aarch64_cross.sh)
## Building with make on UNIX systems (deprecated)

@ -40,51 +40,52 @@ cmake \
make -j4 install
popd
# Download raspberry pi toolchain.
mkdir -p "/tmp/raspberrypi_root"
pushd "/tmp/raspberrypi_root"
git clone https://github.com/raspberrypi/tools raspberrypi-tools
cd raspberrypi-tools && git checkout 4a335520900ce55e251ac4f420f52bf0b2ab6b1f && cd ..
# Write a toolchain file to use for cross-compiling.
cat > toolchain.cmake <<'EOT'
cat > /tmp/toolchain.cmake <<'EOT'
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm)
set(devel_root /tmp/raspberrypi_root)
set(CMAKE_STAGING_PREFIX ${devel_root}/stage)
set(tool_root ${devel_root}/raspberrypi-tools/arm-bcm2708)
set(CMAKE_SYSROOT ${tool_root}/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/sysroot)
set(CMAKE_C_COMPILER ${tool_root}/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${tool_root}/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++)
SET(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_STAGING_PREFIX /tmp/stage)
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc-6)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++-6)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
EOT
# Build and install absl (absl won't be installed down below)
mkdir -p "third_party/abseil-cpp/cmake/build_arm"
pushd "third_party/abseil-cpp/cmake/build_arm"
cmake -DCMAKE_TOOLCHAIN_FILE=/tmp/toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/tmp/install \
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
../..
make -j4 install
popd
# Build and install gRPC for raspberry pi.
# Build and install gRPC for ARM.
# This build will use the host architecture copies of protoc and
# grpc_cpp_plugin that we built earlier because we installed them
# to a location in our PATH (/usr/local/bin).
mkdir -p "cmake/raspberrypi_build"
pushd "cmake/raspberrypi_build"
cmake -DCMAKE_TOOLCHAIN_FILE=/tmp/raspberrypi_root/toolchain.cmake \
mkdir -p "cmake/build_arm"
pushd "cmake/build_arm"
cmake -DCMAKE_TOOLCHAIN_FILE=/tmp/toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/tmp/raspberrypi_root/grpc_install \
-DCMAKE_INSTALL_PREFIX=/tmp/install \
../..
make -j4 install
popd
# Build helloworld example for raspberry pi.
# Build helloworld example for ARM.
# As above, it will find and use protoc and grpc_cpp_plugin
# for the host architecture.
mkdir -p "examples/cpp/helloworld/cmake/raspberrypi_build"
pushd "examples/cpp/helloworld/cmake/raspberrypi_build"
cmake -DCMAKE_TOOLCHAIN_FILE=/tmp/raspberrypi_root/toolchain.cmake \
mkdir -p "examples/cpp/helloworld/cmake/build_arm"
pushd "examples/cpp/helloworld/cmake/build_arm"
cmake -DCMAKE_TOOLCHAIN_FILE=/tmp/toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DProtobuf_DIR=/tmp/raspberrypi_root/stage/lib/cmake/protobuf \
-DgRPC_DIR=/tmp/raspberrypi_root/stage/lib/cmake/grpc \
-DProtobuf_DIR=/tmp/stage/lib/cmake/protobuf \
-DgRPC_DIR=/tmp/stage/lib/cmake/grpc \
../..
make
popd

@ -0,0 +1,29 @@
# Copyright 2021 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM debian:stretch
# gRPC C++ dependencies based on https://github.com/grpc/grpc/blob/master/BUILDING.md
RUN apt-get update && apt-get install -y build-essential autoconf libtool pkg-config && apt-get clean
# debian stretch has cmake 3.7: https://packages.debian.org/stretch/cmake
RUN apt-get update && apt-get install -y cmake && apt-get clean
# C++ distribtests are setup in a way that requires git
RUN apt-get update && apt-get install -y git && apt-get clean
# aarch cross-compiler
RUN apt-get update && apt-get install -y g++-6-aarch64-linux-gnu
CMD ["bash"]

@ -326,7 +326,8 @@ def targets():
CppDistribTest('linux', 'x64', 'stretch',
'cmake_module_install_pkgconfig'),
CppDistribTest('linux', 'x64', 'stretch', 'cmake_pkgconfig'),
CppDistribTest('linux', 'x64', 'stretch', 'raspberry_pi'),
CppDistribTest('linux', 'x64', 'stretch_aarch64_cross',
'cmake_aarch64_cross'),
CppDistribTest('windows', 'x86', testcase='cmake'),
CppDistribTest('windows', 'x86', testcase='cmake_as_externalproject'),
# C#

Loading…
Cancel
Save