[linux-audio-dev] Compiling with libsndfile

Paul Davis paul at linuxaudiosystems.com
Wed Apr 9 11:46:00 UTC 2003

>Thanks for your reply, Erik.
>I see now that there is some info about using pkg-config in the
>documentation, but I hadn't understood its significance, being fairly
>new to Linux development.
>What I have is a simple test app that just opens an audio file and
>prints out the properties.
>I'm compiling it with 
>gcc test.c -o test `pkg-config --cflags --libs sndfile`
>But I always get the result
>./test: error while loading shared libraries: libsndfile.so.1: cannot
>open shared object file: No such file or directory.
>The headers and libraries referenced by pkg-config all seem to be in the
>right place.

as it would have indicated during the install of libsndfile, you need
to either:

   set LD_LIBRARY_PATH to include wherever the library is located OR
   edit /etc/ld.so.config to contain the directory where the library
      is located, and then run ldconfig (as root)

shared libraries are found by using a combination of LD_LIBRARY_PATH
and the ld.so.config file. if a library cannot be found that way
(though strictly, there are a couple of other (bad) options), then you
get the error you've encountered.


More information about the Linux-audio-dev mailing list