From a0b1b70819ffe9fe92b3b74d64d0b49647cd0f8e Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 12 Apr 2021 12:25:26 +0200 Subject: [PATCH] fixups in python_crosscompile_aarch64.sh add --host=aarch64 to ./configure invocation use protoc_qemu_wrapper.sh --- .../linux/aarch64/python_crosscompile_aarch64.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/kokoro/linux/aarch64/python_crosscompile_aarch64.sh b/kokoro/linux/aarch64/python_crosscompile_aarch64.sh index 7933be40d3..08db37cd88 100755 --- a/kokoro/linux/aarch64/python_crosscompile_aarch64.sh +++ b/kokoro/linux/aarch64/python_crosscompile_aarch64.sh @@ -8,14 +8,20 @@ set -ex PYTHON="/opt/python/cp38-cp38/bin/python" ./autogen.sh -CXXFLAGS="-fPIC -g -O2" ./configure +CXXFLAGS="-fPIC -g -O2" ./configure --host=aarch64 make -j8 +# 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 +chmod ugo+x protoc_qemu_wrapper.sh + +# PROTOC variable is by build_py step that runs under ./python directory +export PROTOC=../protoc_qemu_wrapper.sh + pushd python -# TODO: currently this step relies on qemu being registered with binfmt_misc so that -# aarch64 binaries are automatically run with an emulator. This works well once -# "sudo apt install qemu-user-static binfmt-support" is installed on the host machine. +# NOTE: this step will use protoc_qemu_wrapper.sh to generate protobuf files. ${PYTHON} setup.py build_py # when crosscompiling for aarch64, --plat-name needs to be set explicitly