From 713efdf66dca8e60c3db1e720a9bb2bd074c40f3 Mon Sep 17 00:00:00 2001 From: Malik Talha Date: Fri, 6 Oct 2023 01:46:44 +0500 Subject: Fix Scipy, OpenBlas, and NumPy library linking issues This fixes the linking issues primarily between Scipy and OpenBlas caused due to Scipy expecting a different name for OpenBlas dynamic linking library. Bug-AGL: SPEC-4925 Change-Id: Idb8f620134d63e7d9425a0df8942370430b3f700 Signed-off-by: Malik Talha --- meta-offline-voice-agent/README | 46 ---------------------- meta-offline-voice-agent/README.md | 6 --- .../recipes-blas/openblas/openblas_git.bb | 5 ++- .../python3-scipy/python3-scipy-native_1.8.1.bb | 1 + .../python3-scipy/python3-scipy_1.8.1.bb | 2 + 5 files changed, 7 insertions(+), 53 deletions(-) delete mode 100644 meta-offline-voice-agent/README diff --git a/meta-offline-voice-agent/README b/meta-offline-voice-agent/README deleted file mode 100644 index 233e0fc9..00000000 --- a/meta-offline-voice-agent/README +++ /dev/null @@ -1,46 +0,0 @@ -Offline Speech Recognition using Vosk (Kaldi-ASR) : meta-offline-voice-agent -========================================================================= - -meta-offline-voice-agent is the AGL Layer using Vosk API based on Kaldi ASR Toolkit to enable Offline Speech Recognition capabilities for Automotive Grade Linux. - - -WIP -======== -The layer in its current state contains the Vosk library, and is capable of recognizing speech, as verified from the test scripts contained in https://github.com/alphacep/vosk-api/tree/master/python/example. - -### Working features: -- [vosk-api (python)](https://github.com/alphacep/vosk-api/tree/master/python) -- [vosk-websocket-server](https://github.com/alphacep/vosk-server/tree/master/websocket) - - -Testing vosk-api on AGL -====================== - -### 1. Initializing the build environment: - -The `agl-offline-voice-agent` feature needs to be enabled when including aglsetup.sh: - -```shell -$ source meta-agl/scripts/aglsetup.sh -m qemux86-64 -b build-voice-qemux86-64 agl-demo agl-offline-voice-agent ${AGL_META_PYTHON} - -$ bitbake agl-demo-platform -``` - -### 2. Running the image: - -```shell -$ runqemu tmp/deploy/images/qemux86-64/agl-demo-platform-qemux86-64.qemuboot.conf kvm serialstdio slirp publicvnc audio -``` - -### 3. Run the test with ptest-runner: - -```shell -$ ptest-runner python3-vosk-api -``` - -### Currently supported targets: -- QEMU x86-64: Work in progress. - -Maintainers: -- Aman Arora - diff --git a/meta-offline-voice-agent/README.md b/meta-offline-voice-agent/README.md index abde819a..bed8b35e 100644 --- a/meta-offline-voice-agent/README.md +++ b/meta-offline-voice-agent/README.md @@ -59,12 +59,6 @@ EXTRA_IMAGE_FEATURES += "ptest-pkgs" The above method may be the easiest one but it's not recommended because `ptests` increase the image build times by a substantial amount. You can look into the official [vosk-api docs](https://alphacephei.com/vosk/install) for usage and other ways of testing. ### Test Snips -(**Important**) Currently, there are some library linking issues between NumPy, SciPy, and OpenBLAS. While we investigate and fix them you need to use `LD_PRELOAD` method as a workaround for Snips to work properly. Input the following command as soon as you boot into the target image: -```shell -$ export LD_PRELOAD=/usr/lib/libopenblas.so.0 -``` - - In order to test the Snips NLU Intent Engine you can use the sample [pre-trained model](https://github.com/malik727/snips-model-agl), by default it automatically gets built into the target image when you include this layer. To perform inference using this model you can run the following command inside your target image: ```shell $ snips-inference parse /usr/share/nlu/snips/model/ -q "your command here" diff --git a/meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb b/meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb index 84e76542..7f105e26 100644 --- a/meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb +++ b/meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb @@ -49,13 +49,16 @@ EXTRA_OEMAKE = "\ do_install() { oe_runmake PREFIX=${D}${prefix} install rm -rf ${D}${bindir} ${D}${libdir}/cmake + # fixup pkgconfig file sed -i -e "s#libdir=/.*#libdir=${libdir}#" ${D}${libdir}/pkgconfig/openblas.pc sed -i -e "s#includedir=/.*#includedir=${includedir}#" ${D}${libdir}/pkgconfig/openblas.pc cat ${D}${libdir}/pkgconfig/openblas.pc + # Create symlink from libblas.so to libopenblas.so.0, required by scipy + ln -s libopenblas.so.0 ${D}${libdir}/libblas.so } -FILES:${PN}-dev = "${includedir} ${libdir}/lib${PN}.so" FILES:${PN} = "${libdir}/*" +FILES:${PN}-dev = "${includedir} ${libdir}/libopenblas.so ${libdir}/libblas.so" diff --git a/meta-offline-voice-agent/recipes-python/python3-scipy/python3-scipy-native_1.8.1.bb b/meta-offline-voice-agent/recipes-python/python3-scipy/python3-scipy-native_1.8.1.bb index ca46f9db..8827e58e 100644 --- a/meta-offline-voice-agent/recipes-python/python3-scipy/python3-scipy-native_1.8.1.bb +++ b/meta-offline-voice-agent/recipes-python/python3-scipy/python3-scipy-native_1.8.1.bb @@ -20,6 +20,7 @@ DEPENDS += " \ ${PYTHON_PN}-beniget-native \ ${PYTHON_PN}-ply-native \ lapack-native \ + openblas-native \ " CLEANBROKEN = "1" diff --git a/meta-offline-voice-agent/recipes-python/python3-scipy/python3-scipy_1.8.1.bb b/meta-offline-voice-agent/recipes-python/python3-scipy/python3-scipy_1.8.1.bb index 2c9424e6..1f562ebf 100644 --- a/meta-offline-voice-agent/recipes-python/python3-scipy/python3-scipy_1.8.1.bb +++ b/meta-offline-voice-agent/recipes-python/python3-scipy/python3-scipy_1.8.1.bb @@ -19,6 +19,7 @@ DEPENDS += " \ ${PYTHON_PN}-beniget-native \ ${PYTHON_PN}-ply-native \ lapack \ + openblas \ " inherit pypi setuptools3 @@ -26,6 +27,7 @@ inherit pypi setuptools3 RDEPENDS:${PN} += " \ ${PYTHON_PN}-numpy \ lapack \ + openblas \ " CLEANBROKEN = "1" -- cgit 1.2.3-korg