Fix Scipy, OpenBlas, and NumPy library linking issues 65/29265/2
authorMalik Talha <talhamalik727x@gmail.com>
Thu, 5 Oct 2023 20:46:44 +0000 (01:46 +0500)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Fri, 6 Oct 2023 13:19:50 +0000 (13:19 +0000)
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 <talhamalik727x@gmail.com>
meta-offline-voice-agent/README [deleted file]
meta-offline-voice-agent/README.md
meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb
meta-offline-voice-agent/recipes-python/python3-scipy/python3-scipy-native_1.8.1.bb
meta-offline-voice-agent/recipes-python/python3-scipy/python3-scipy_1.8.1.bb

diff --git a/meta-offline-voice-agent/README b/meta-offline-voice-agent/README
deleted file mode 100644 (file)
index 233e0fc..0000000
+++ /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 <aman.arora9848@gmail.com>
-
index abde819..bed8b35 100644 (file)
@@ -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"
index 84e7654..7f105e2 100644 (file)
@@ -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"
index ca46f9d..8827e58 100644 (file)
@@ -20,6 +20,7 @@ DEPENDS += " \
        ${PYTHON_PN}-beniget-native \
        ${PYTHON_PN}-ply-native \
        lapack-native \
+       openblas-native \
 "
 
 CLEANBROKEN = "1"
index 2c9424e..1f562eb 100644 (file)
@@ -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"