Raspberry pi, libarmmem.so (cannot open shared object file) error

I experienced the same error coming from a snapd 'snap'. I went into the preload file mentioned

sudo nano /etc/ld.so.preload

and commented the offending line out from

/usr/lib/arm-linux-gnueabihf/libarmmem.so

to

#/usr/lib/arm-linux-gnueabihf/libarmmem.so


1. Get you plataform

Check your platform in /proc/cpuinfo using command below

cat /proc/cpuinfo | grep 'model name';

In my case (Raspberry Pi 4), return:

model name  : ARMv7 Processor rev 3 (v7l)
model name  : ARMv7 Processor rev 3 (v7l)
model name  : ARMv7 Processor rev 3 (v7l)
model name  : ARMv7 Processor rev 3 (v7l)

You can view the options for ARM memory library, using command below:

ls /usr/lib/arm-linux-gnueabihf/libarmmem*

In my case, return:

/usr/lib/arm-linux-gnueabihf/libarmmem-aarch64.so
/usr/lib/arm-linux-gnueabihf/libarmmem-v6l.so
/usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so
/usr/lib/arm-linux-gnueabihf/libarmmem-v8l.so

Then, according with /proc/cpuinfo, I need to use /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so, because exist a library for my platform:

CPU info results List Results
ARMv7 Processor rev 3 (v7l) /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so

2. Setup Dynamic Linker

Change preload of dynamic linker using command below:

sudo nano /etc/ld.so.preload

Using nano editor, replace

/usr/lib/arm-linux-gnueabihf/libarmmem.so

or in my case

/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATAFORM}.so

by

/usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so

or according your platform.