I'm trying to get a demo working writing PCM to the I2S; I've created a small demo program that gives an error when I run with the following command ./demo stereo_small.wav
can't open /dev/mem
So I run with the this command sudo ./demo stereo_small.wav (added sudo) and the demo should now be able to run successfully with elevated privileges.
But I now get this error:
./demo: error while loading shared libraries: libsndfile.so.1: cannot open shared object file: No such file or directory
Initially, to get the program working, I had to execute this command export LD_LIBRARY_PATH=/usr/local/lib just to get it to work, and now the error has returned, but only when I prefix the command with sudo
Please bare with me I've only been using C & Linux for a few hours!
Here's what I've done to compile and run:
gcc `pkg-config --cflags sndfile` -c demo.c
gcc 'pkg-config --libs sndfile' demo.o -o demo
sudo ./demo stereo_small.wav
Update - Cause: some environment variables aren't maintained under the SU context see here