Compile SDL2_Mixer with libvorbis statically

972 Views Asked by At

I've been trying to build SDL2_Mixer with OGG support but even though libvorbis and libogg libraries are part of their sources: https://hg.libsdl.org/SDL_mixer/file/7e59d684b070/external it doesn't seem to add support for ogg at compile time.

Interestingly if I provide these flags to SDL2_Mixer configure: --enable-music-ogg=true --enable-music-ogg-shared=false. I get no errors but the support is missing. If I omit all of the above and just keep: --disable-shared --enable-static I get the following error from the configure:

checking vorbis/vorbisfile.h usability... no
checking vorbis/vorbisfile.h presence... no
checking for vorbis/vorbisfile.h... no
checking for ov_open_callbacks in -lvorbisfile -lvorbis -logg -lm... no
configure: WARNING: *** Unable to find Ogg Vorbis library (http://www.xiph.org/)
configure: WARNING: Ogg Vorbis support disabled

But it doesn't make much sense to me since SDL2_Mixer comes with those libraries on its own :(.

I could be passing some paths or anything wrong to it but I have no idea what.

This is the CMakeLists.txt I am using to compile the project.

I've also bumped into this: http://forums.libsdl.org/viewtopic.php?p=20698 which sounds close to my issue, though using an older SDL_Mixer.

And I've also bumped into this thread: https://swarminglogic.com/article/2014_11_crosscompile2 and it feels odd he downloads ogg and vorbis sources separately if those are part of SDL2_Mixer anyway. In any case I've tried to build the libraries separately too but wasn't able to make SDL2_Mixer see them either.

I would be very grateful for any hints on how to resolve this as I seem to be stuck at this point for quite a while now.

Thank you very much :)

1

There are 1 best solutions below

0
On

Ok, so it seems although SDL2_Mixer comes with ogg and vorbis libraries it just doesn't use them to compile even if set to static.

I myself wasn't able to force those libraries in but there is this new branch of SDL2 demo that adds ogg and vorbis libraries to the project: https://gitlab.com/zub2/SDLDemo/tree/addOggVorbis

This comment in the CmakeLists.txt is a nice summary on what's going on:

"SDL2_mixer needs to find libogg and libvorbis, and it's not using pkg-config"

so CFLAGS etc. have to be used unfortunately.