Add an rpi4ub-armv8 build variant

This commit is contained in:
Olivier 'reivilibre' 2021-12-04 15:45:45 +00:00
parent 8cea2cbfec
commit 0f698133aa
4 changed files with 64 additions and 0 deletions

View File

@ -213,6 +213,27 @@ The path of the system tree can be overridden from the default values defined in
cd ../STT/native_client
make TARGET=<system> stt
RPi4 ARMv8 (Ubuntu 21.10)
^^^^^^^^^^^^^^^^^^^^^^^^^
We support cross-compilation from Linux hosts. The following ``--config`` flags can be specified when building with bazel:
* ``--config=rpi4ub-armv8_opt`` for Ubuntu / ARM64
Your command line should look like:
.. code-block::
bazel build --workspace_status_command="bash native_client/bazel_workspace_status_cmd.sh" -c opt --config=rpi4ub-armv8_opt //native_client:libstt.so
The ``stt`` binary can also be cross-built, with ``TARGET=rpi4ub-armv8``. This might require you to setup a system tree using the tool ``multistrap`` and the multistrap configuration file: ``native_client/multistrap-ubuntu64-impish.conf``.
The path of the system tree can be overridden from the default values defined in ``definitions.mk`` through the ``RASPBIAN`` ``make`` variable.
.. code-block::
cd ../STT/native_client
make TARGET=rpi4ub-armv8 stt
Building ``libstt.so`` for Android
----------------------------------

View File

@ -19,6 +19,13 @@ config_setting(
},
)
config_setting(
name = "rpi4ub-armv8",
define_values = {
"target_system": "rpi4ub-armv8"
},
)
genrule(
name = "workspace_status",
outs = ["workspace_status.cc"],

View File

@ -112,6 +112,28 @@ NODE_PLATFORM_TARGET := --target_arch=arm64 --target_platform=linux
TOOLCHAIN_LDD_OPTS := --root $(RASPBIAN)/
endif # ($(TARGET),rpi3-armv8)
# Custom: RPi 4, Ubuntu 21.10, Arm v8 (64-bit)
ifeq ($(TARGET),rpi4ub-armv8)
TOOLCHAIN_DIR ?= ${TFDIR}/bazel-$(shell basename "${TFDIR}")/external/LinaroAarch64Gcc72/bin
TOOLCHAIN ?= $(TOOLCHAIN_DIR)/aarch64-linux-gnu-
RASPBIAN ?= $(abspath $(NC_DIR)/../multistrap-ubuntu64-impish)
CFLAGS := -march=armv8-a -mtune=cortex-a72 -D_GLIBCXX_USE_CXX11_ABI=0 --sysroot $(RASPBIAN)
CXXFLAGS := $(CFLAGS)
LDFLAGS := -Wl,-rpath-link,$(RASPBIAN)/lib/aarch64-linux-gnu/ -Wl,-rpath-link,$(RASPBIAN)/usr/lib/aarch64-linux-gnu/
SOX_CFLAGS := -I$(RASPBIAN)/usr/include
SOX_LDFLAGS := $(RASPBIAN)/usr/lib/aarch64-linux-gnu/libsox.so
PYVER := $(shell python -c "import platform; maj, min, _ = platform.python_version_tuple(); print(maj+'.'+min);")
PYTHON_PACKAGES :=
PYTHON_PATH := PYTHONPATH=$(RASPBIAN)/usr/lib/python$(PYVER)/:$(RASPBIAN)/usr/lib/python3/dist-packages/
PYTHON_SYSCONFIGDATA := _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_m_linux_aarch64-linux-gnu
NUMPY_INCLUDE := NUMPY_INCLUDE=$(RASPBIAN)/usr/include/python3.9/
PYTHON_PLATFORM_NAME := --plat-name linux_aarch64
NODE_PLATFORM_TARGET := --target_arch=arm64 --target_platform=linux
TOOLCHAIN_LDD_OPTS := --root $(RASPBIAN)/
endif # ($(TARGET),rpi4ub-armv8)
ifeq ($(TARGET),ios-simulator)
CFLAGS := -isysroot $(shell xcrun -sdk iphonesimulator13.5 -show-sdk-path)
SOX_CFLAGS :=

View File

@ -0,0 +1,14 @@
[General]
arch=arm64
noauth=false
unpack=true
debootstrap=Debian
aptsources=Debian
cleanup=true
[Debian]
packages=apt libc6 libc6-dev libstdc++-7-dev linux-libc-dev libffi-dev libpython3.9-dev libsox-dev python3-numpy python3-setuptools
source=http://ports.ubuntu.com/ubuntu-ports
keyring=ubuntu-keyring
components=main universe
suite=impish