Skip to content

Commit

Permalink
Migrate linux-aarch64 tests away from autotools (#10015)
Browse files Browse the repository at this point in the history
Autotools support is being deprecated, so this moves some of our kokoro tests to cmake
  • Loading branch information
mkruskal-google authored May 26, 2022
1 parent 0e42bf9 commit f2e06fe
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@

set -ex

mkdir -p cmake/crossbuild_aarch64
cd cmake/crossbuild_aarch64

# the build commands are expected to run under dockcross docker image
# where the CC, CXX and other toolchain variables already point to the crosscompiler
cmake ..
cmake .
make -j8

# check that the resulting test binary is indeed an aarch64 ELF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ else
fi

# Pin the dockcross image since newer versions of the image break the build
PINNED_DOCKCROSS_IMAGE_VERSION=dockcross/manylinux2014-aarch64:20210803-41e5c69
# We use an older version of dockcross image that has gcc4.9.4 because it was built
# before https://github.com/dockcross/dockcross/pull/449
# Thanks to that, wheel build with this image aren't actually
# compliant with manylinux2014, but only with manylinux_2_24
PINNED_DOCKCROSS_IMAGE_VERSION=dockcross/manylinux2014-aarch64:20200929-608e6ac

# running dockcross image without any arguments generates a wrapper
# scripts that can be used to run commands under the dockcross image
Expand Down
3 changes: 1 addition & 2 deletions kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@

set -ex

./autogen.sh
CXXFLAGS="-fPIC -g -O2" ./configure --host=aarch64
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_WITH_ZLIB=0 .
make -j8
13 changes: 10 additions & 3 deletions kokoro/linux/aarch64/python_crosscompile_aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ set -ex

PYTHON="/opt/python/cp38-cp38/bin/python"

./autogen.sh
CXXFLAGS="-fPIC -g -O2" ./configure --host=aarch64
# Initialize any submodules.
git submodule update --init --recursive

# Build protoc and libprotobuf
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_WITH_ZLIB=0 .
make -j8

# Copy lib files to the expected location.
mkdir -p src/.libs
ln -f *.a src/.libs/

# create a simple shell wrapper that runs crosscompiled protoc under qemu
echo '#!/bin/bash' >protoc_qemu_wrapper.sh
echo 'exec qemu-aarch64 "../src/protoc" "$@"' >>protoc_qemu_wrapper.sh
echo 'exec qemu-aarch64 "../protoc" "$@"' >>protoc_qemu_wrapper.sh
chmod ugo+x protoc_qemu_wrapper.sh

# PROTOC variable is by build_py step that runs under ./python directory
Expand Down
2 changes: 1 addition & 1 deletion kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ${PYTHON} -m pip install --user pytest auditwheel
# we've built the python extension previously with --inplace option
# so we can just discover all the unittests and run them directly under
# the python/ directory.
LD_LIBRARY_PATH=../src/.libs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp ${PYTHON} -m pytest google/protobuf
LD_LIBRARY_PATH=. PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp ${PYTHON} -m pytest google/protobuf

# step 2: run auditwheel show to check that the wheel is manylinux2014 compatible.
# auditwheel needs to run on wheel's target platform (or under an emulator)
Expand Down

0 comments on commit f2e06fe

Please sign in to comment.