[Vorbis] libvorbisfile dynamic linkage with pkg-config - inter-library dependencies?

Ralph Giles giles at thaumas.net
Mon Aug 11 13:03:32 PDT 2014


On 2014-08-09 3:04 PM, Richard Ash wrote:

> vorbis_block_init() is called from ExportOGG.cpp, although that file
> doesn't #include vorbis/codec.h - the only include from libvorbis is
> #include <vorbis/vorbisenc.h>, which presumably brings the necessary
> headers in indirectly?

Yes, vorbisenc.h includes codec.h.

> The only solution I have found is to explicitly ask pkg-config for the
> dependent libraries (libvorbis and libogg) when calling pkg-config, so
> do
>  pkg-config --libs --print-errors "vorbisfile vorbis ogg"
> in order to get
>  -lvorbisfile -lvorbis -logg

So vorbisfile.pc has vorbis as a Requires.private. I think the way this
is supposed to work is that if you're linking to the shared libraries,
transitive deps in the .so files will pull in vorbis when you '-l
vorbisfile'. When you link statically (so pkg-config --libs --static
vorbisfile) then you get -lvorbis -logg -lm, etc.

The question is why this isn't working for you. Are you linking
statically? Is the build system passing --static to pkg-config? There
are systems where the linker doesn't see dependencies inside .so files,
but x86_64-pc-linux-gnu isn't one of them.

For theora, we use a 'Requires' instead of a 'Requires.private' so it
works unconditionally. If my understand above is correct, that's not
optimal, but might work around your problem. Try that as well?

 -r



More information about the Vorbis mailing list