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
linux
tag is probably redundant. It would be better if you provided your distribution instead (probably Debian). – Jivings Jun 20 '12 at 23:15libsndfile
is where you think it is? Check that directory. Also check the output ofecho $LD_LIBRARY_PATH
matches it. – Jivings Jun 20 '12 at 23:23/dev/mem
? – Jivings Jun 20 '12 at 23:24sudo -s
, that should maintain your environment. – Jivings Jun 20 '12 at 23:36ls -l /dev
? – Alex Chamberlain Jun 21 '12 at 07:06rw
forroot
andr
for group, and the group iskmem
. – Jivings Jun 21 '12 at 18:46/usr/local/lib
to the path variable like thisexport PATH=$PATH:/usr/local/lib
. – Jivings Jun 21 '12 at 18:47