Some progress in my analysis that I’d like to share.
In /usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/__main__.py
the following code is used to build the directory where to search for the files based on the machine architecture.
machine = platform.machine()
if args.keyword_dir:
args.keyword_dir = [Path(d) for d in args.keyword_dir]
# Add embedded keywords too
keyword_base = _DIR / "porcupine" / "resources" / "keyword_files"
if machine in ["armv6l", "armv7l", "armv8"]:
# Raspberry Pi
args.keyword_dir.append(keyword_base / "raspberrypi")
else:
# Desktop/server
args.keyword_dir.append(keyword_base / "linux")
The thing is, that
python -c 'import platform; print(platform.machine())'
on a Ubuntu 20.04 64-bit system returns aarch64
, which is not mapped to raspberrypi
in the above if-clause.
UPDATE: Further down on line 110 in main.py there is another check against the machine type:
elif machine in ["armv7l", "armv8"]:
# Pi 2 uses Cortex A7
# Pi 3 uses Cortex A53
# Pi 4 uses Cortex A72
cpu_model = guess_cpu_model()
_LOGGER.debug("Guessing you have an ARM %s", cpu_model)
lib_dir = os.path.join(lib_dir, "raspberry-pi", str(cpu_model.value))
I added aarch64
to both spots which does built the right directories, BUT then you get this error:
OSError: /usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/porcupine/lib/raspberry-pi/cortex-a53/libpv_porcupine.so: wrong ELF class: ELFCLASS32
Is it possible that it is not intended to run porcupine on a 64-bit OS on ARM architecture?