Fangjun Kuang
Committed by GitHub

Fix building RKNN wheels (#2233)

@@ -25,33 +25,20 @@ jobs: @@ -25,33 +25,20 @@ jobs:
25 with: 25 with:
26 fetch-depth: 0 26 fetch-depth: 0
27 27
28 - - name: Setup Python ${{ matrix.python-version }}  
29 - uses: actions/setup-python@v5  
30 - with:  
31 - python-version: ${{ matrix.python-version }}  
32 -  
33 - - name: Install Python dependencies  
34 - shell: bash  
35 - run: |  
36 - python3 -m pip install --upgrade pip numpy pypinyin sentencepiece setuptools wheel  
37 -  
38 - - name: ccache  
39 - uses: hendrikmuhs/ccache-action@v1.2  
40 - with:  
41 - key: ${{ matrix.os }}-rknn-linux-aarch64-wheel  
42 -  
43 - name: Download rknn-toolkit2 28 - name: Download rknn-toolkit2
44 shell: bash 29 shell: bash
45 run: | 30 run: |
46 git clone --depth 1 https://github.com/airockchip/rknn-toolkit2 31 git clone --depth 1 https://github.com/airockchip/rknn-toolkit2
47 32
48 - name: Build sherpa-onnx 33 - name: Build sherpa-onnx
  34 + uses: addnab/docker-run-action@v3
  35 + with:
  36 + image: quay.io/pypa/manylinux_2_28_aarch64
  37 + # image: quay.io/pypa/manylinux2014_aarch64 # it does not provide GLIBCXX 3.4.21+
  38 + options: |
  39 + --volume ${{ github.workspace }}/:/k2-fsa/sherpa-onnx
49 shell: bash 40 shell: bash
50 run: | 41 run: |
51 - export CMAKE_CXX_COMPILER_LAUNCHER=ccache  
52 - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"  
53 - cmake --version  
54 -  
55 echo "config: ${{ matrix.config }}" 42 echo "config: ${{ matrix.config }}"
56 uname -a 43 uname -a
57 which gcc 44 which gcc
@@ -59,12 +46,60 @@ jobs: @@ -59,12 +46,60 @@ jobs:
59 gcc --version 46 gcc --version
60 g++ --version 47 g++ --version
61 48
  49 + find /opt -name "python*"
  50 +
  51 + py=${{ matrix.python-version }}
  52 +
  53 + for v in $(seq 0 99); do
  54 + if [ -f /opt/_internal/cpython-$py.$v/bin/python3 ]; then
  55 + py=/opt/_internal/cpython-$py.$v/bin/python3
  56 + break
  57 + fi
  58 + done
  59 +
  60 + # there is
  61 + # py=/opt/_internal/cpython-3.13.3-nogil/bin/python3
  62 + #
  63 + echo "py: $py"
  64 +
  65 + $py --version
  66 +
  67 + $py -m venv my-py
  68 +
  69 + python3 --version
  70 + which python3
  71 +
  72 + source ./my-py/bin/activate
  73 +
  74 + python3 --version
  75 + which python3
  76 +
  77 + python3 -m pip install wheel twine setuptools
  78 +
62 echo "pwd" 79 echo "pwd"
63 80
  81 + cd /k2-fsa/sherpa-onnx/
  82 +
64 ls -lh 83 ls -lh
65 84
66 - sudo apt-get update -y  
67 - sudo apt-get install -y alsa-utils libasound2-dev 85 + cmake --version
  86 +
  87 + echo "config: ${{ matrix.config }}"
  88 + uname -a
  89 + echo "pwd"
  90 +
  91 + git clone --depth 1 --branch v1.2.12 https://github.com/alsa-project/alsa-lib
  92 + pushd alsa-lib
  93 + ./gitcompile
  94 + popd
  95 +
  96 + ls -lh $PWD/alsa-lib/src/.libs
  97 +
  98 + strings $PWD/alsa-lib/src/.libs/libasound.so.2.0.0 | grep "^GLIBC"
  99 +
  100 + export CPLUS_INCLUDE_PATH=$PWD/alsa-lib/include:$CPLUS_INCLUDE_PATH
  101 + export SHERPA_ONNX_ALSA_LIB_DIR=$PWD/alsa-lib/src/.libs
  102 +
68 103
69 export SHERPA_ONNX_RKNN_TOOLKIT2_PATH=$PWD/rknn-toolkit2 104 export SHERPA_ONNX_RKNN_TOOLKIT2_PATH=$PWD/rknn-toolkit2
70 export SHERPA_ONNX_RKNN_TOOLKIT2_LIB_DIR=$SHERPA_ONNX_RKNN_TOOLKIT2_PATH/rknpu2/runtime/Linux/librknn_api/aarch64 105 export SHERPA_ONNX_RKNN_TOOLKIT2_LIB_DIR=$SHERPA_ONNX_RKNN_TOOLKIT2_PATH/rknpu2/runtime/Linux/librknn_api/aarch64
@@ -80,6 +115,15 @@ jobs: @@ -80,6 +115,15 @@ jobs:
80 run: | 115 run: |
81 ls -lh dist 116 ls -lh dist
82 117
  118 + - name: Show glibc versions
  119 + shell: bash
  120 + run: |
  121 + mkdir t
  122 + cp dist/*.whl t
  123 + cd t
  124 + unzip ./*.whl
  125 + strings sherpa_onnx-*.data/data/bin/sherpa-onnx | grep GLIBC
  126 +
83 - name: Publish to huggingface 127 - name: Publish to huggingface
84 env: 128 env:
85 HF_TOKEN: ${{ secrets.HF_TOKEN }} 129 HF_TOKEN: ${{ secrets.HF_TOKEN }}