Add MUSL build

This commit is contained in:
Nickolay Shmyrev 2025-05-01 11:06:56 +02:00
parent 47509f7f9c
commit 780ba2f0b7
4 changed files with 59 additions and 1 deletions

View File

@ -44,6 +44,7 @@ RUN cd /opt \
&& cd /opt/kaldi/src \
&& sed -i "s:TARGET_ARCH=\"\`uname -m\`\":TARGET_ARCH=$(echo $CROSS_TRIPLE|cut -d - -f 1):g" configure \
&& sed -i "s: -O1 : -O3 :g" makefiles/linux_openblas_arm.mk \
&& sed -i "s: -O1 : -O3 :g" makefiles/linux_openblas_arm.mk \
&& ./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no \
&& make -j 10 online2 rnnlm \
&& find /opt/kaldi -name "*.o" -exec rm {} \;

View File

@ -0,0 +1,50 @@
ARG DOCKCROSS_IMAGE=alphacep/dockcross-linux-armv7
FROM ${DOCKCROSS_IMAGE}
LABEL description="A docker image for building portable Python linux binary wheels and Kaldi on other architectures"
LABEL maintainer="contact@alphacephei.com"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
libffi-dev \
libpcre3-dev \
zlib1g-dev \
automake \
autoconf \
libtool \
cmake \
python3 \
python3-pip \
python3-wheel \
python3-setuptools \
python3-cffi \
&& rm -rf /var/lib/apt/lists/*
ARG OPENBLAS_ARGS=
RUN cd /opt \
&& git clone -b vosk --single-branch https://github.com/alphacep/kaldi \
&& cd kaldi/tools \
&& git clone -b v0.3.20 --single-branch https://github.com/xianyi/OpenBLAS \
&& git clone -b v3.2.1 --single-branch https://github.com/alphacep/clapack \
&& echo ${OPENBLAS_ARGS} \
&& make -C OpenBLAS ONLY_CBLAS=1 ${OPENBLAS_ARGS} HOSTCC=gcc USE_LOCKING=1 USE_THREAD=0 all \
&& make -C OpenBLAS ${OPENBLAS_ARGS} HOSTCC=gcc USE_LOCKING=1 USE_THREAD=0 PREFIX=$(pwd)/OpenBLAS/install install \
&& mkdir -p clapack/BUILD && cd clapack/BUILD && cmake .. \
&& make -j 10 -C F2CLIBS \
&& make -j 10 -C BLAS \
&& make -j 10 -C SRC \
&& find . -name "*.a" | xargs cp -t ../../OpenBLAS/install/lib \
&& cd /opt/kaldi/tools \
&& git clone --single-branch https://github.com/alphacep/openfst openfst \
&& cd openfst \
&& autoreconf -i \
&& CFLAGS="-g -O3" ./configure --prefix=/opt/kaldi/tools/openfst --enable-static --enable-shared --enable-far --enable-ngram-fsts --enable-lookahead-fsts --with-pic --disable-bin --host=${CROSS_TRIPLE} --build=x86-linux-gnu \
&& make -j 10 && make install \
&& cd /opt/kaldi/src \
&& sed -i "s:TARGET_ARCH=\"\`uname -m\`\":TARGET_ARCH=$(echo $CROSS_TRIPLE|cut -d - -f 1):g" configure \
&& sed -i "s: -O1 : -O3 :g" makefiles/linux_openblas_arm.mk \
&& sed -i "s:-DHAVE_EXECINFO_H=1::g" makefiles/linux_openblas_arm.mk \
&& ./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no \
&& make -j 10 online2 rnnlm \
&& find /opt/kaldi -name "*.o" -exec rm {} \;

7
travis/build-dockcross-musl.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
set -x
docker build --build-arg="DOCKCROSS_IMAGE=dockcross/linux-armv7l-musl" --build-arg="OPENBLAS_ARGS=TARGET=ARMV7" --file Dockerfile.dockcross-musl --tag alphacep/kaldi-dockcross-armv7-musl:latest .
docker run --rm -v /home/shmyrev/travis/vosk-api/:/io alphacep/kaldi-dockcross-armv7-musl /io/travis/build-wheels-dockcross.sh

View File

@ -33,5 +33,5 @@ mkdir -p /io/wheelhouse/vosk-linux-$VOSK_MACHINE
cp /opt/vosk-api/src/*.so /opt/vosk-api/src/vosk_api.h /io/wheelhouse/vosk-linux-$VOSK_MACHINE
# Build wheel
python3 -m pip install requests tqdm srt websockets wheel
python3 -m pip install requests tqdm srt websockets wheel --break-system-packages
python3 -m pip wheel /opt/vosk-api/python --no-deps -w /io/wheelhouse