SDL2-Mixer cannot find mpg123 and libvorbis function definitions

Platform: Linux, Kubuntu
Compiler: Clang version 13

currently leveraging vcpkg to pull in all dependencies for my project right here. I just got audio working on OSX today, Windows was the most straightforward as everything is dynamically linked. The final platform that’s giving me a hard time is Linux. Here is the error I see after the linker runs…

[build] /bin/ld: vcpkg_installed/x64-linux/debug/lib/libSDL2_mixer.a(music_mpg123.c.o): in function `MPG123_Load':
[build] /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:87: undefined reference to `mpg123_close'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:88: undefined reference to `mpg123_delete'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:89: undefined reference to `mpg123_exit'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:90: undefined reference to `mpg123_format'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:91: undefined reference to `mpg123_format_none'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:92: undefined reference to `mpg123_getformat'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:93: undefined reference to `mpg123_init'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:94: undefined reference to `mpg123_new'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:95: undefined reference to `mpg123_open_handle'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:96: undefined reference to `mpg123_plain_strerror'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:97: undefined reference to `mpg123_rates'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:98: undefined reference to `mpg123_read'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:99: undefined reference to `mpg123_replace_reader_handle'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:100: undefined reference to `mpg123_seek'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_mpg123.c:101: undefined reference to `mpg123_strerror'
[build] /bin/ld: vcpkg_installed/x64-linux/debug/lib/libSDL2_mixer.a(music_ogg.c.o): in function `OGG_Load':
[build] /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_ogg.c:91: undefined reference to `ov_clear'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_ogg.c:92: undefined reference to `ov_info'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_ogg.c:93: undefined reference to `ov_comment'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_ogg.c:94: undefined reference to `ov_open_callbacks'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_ogg.c:95: undefined reference to `ov_pcm_total'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_ogg.c:100: undefined reference to `ov_read'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_ogg.c:101: undefined reference to `ov_time_seek'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_ogg.c:103: undefined reference to `ov_pcm_seek'
[build] /bin/ld: /home/obcurelyme/vcpkg/buildtrees/sdl2-mixer/src/2.0.4-a895b09396.clean/music_ogg.c:104: undefined reference to `ov_pcm_tell'

You can see the definitions are referenced within SDL2-Mixer, but I cannot figure out why they would be undefined.

Here is a snippet from my CMakeLists.txt…

if(LINUX_PLATFORM)
  message("Linking dependencies for Linux")
  add_compile_definitions(_FILE_OFFSET_BITS=64)
  find_package(Ogg CONFIG REQUIRED)
  find_package(Vorbis CONFIG REQUIRED)
  find_package(mpg123 CONFIG REQUIRED)
 
  # libogg
  target_link_libraries(main PRIVATE Ogg::ogg)
  # libvorbis
  target_link_libraries(main PRIVATE Vorbis::vorbis Vorbis::vorbisenc Vorbis::vorbisfile)
  # libmpg123
  target_link_libraries(main PRIVATE MPG123::libmpg123 MPG123::libout123 MPG123::libsyn123)

  # SDL2
  target_link_libraries(main PRIVATE SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
  # SDL2-image
  target_link_libraries(main PRIVATE SDL2::SDL2_image)
  # SDL2-ttf
  target_link_libraries(main PRIVATE SDL2::SDL2_ttf)
  # SDL2-mixer
  target_link_libraries(main PRIVATE SDL2::SDL2_mixer)
endif()

What’s baffling is how the OSX configuration is 100% identical, and historically (for me) what worked on OSX worked on Linux since I’m using clang compiler on both systems. I think the whole position I’m coming from here is to link everything statically on both OSX and Linux, and I’d like any advice on how I can get over this final hurdle. Thanks for reading!

Just a brief edit:

This is what the Linker statement looks like. It seems to be correct to me.

/bin/clang++-13 -g  ${CXX_OBJECT_FILES}  -o main  
vcpkg_installed/x64-linux/debug/lib/libfmtd.a  
vcpkg_installed/x64-linux/debug/lib/libspdlogd.a  
vcpkg_installed/x64-linux/debug/lib/libogg.a 
vcpkg_installed/x64-linux/debug/lib/libvorbis.a  
vcpkg_installed/x64-linux/debug/lib/libvorbisenc.a 
vcpkg_installed/x64-linux/debug/lib/libvorbisfile.a
vcpkg_installed/x64-linux/debug/lib/libmpg123.a 
vcpkg_installed/x64-linux/debug/lib/libout123.a 
vcpkg_installed/x64-linux/debug/lib/libsyn123.a
vcpkg_installed/x64-linux/debug/lib/libSDL2d.a  
vcpkg_installed/x64-linux/debug/lib/libSDL2maind.a
vcpkg_installed/x64-linux/debug/lib/libSDL2d.a
vcpkg_installed/x64-linux/debug/lib/libSDL2_image.a
vcpkg_installed/x64-linux/debug/lib/libSDL2_ttf.a
vcpkg_installed/x64-linux/debug/lib/libSDL2_mixer.a
vcpkg_installed/x64-linux/debug/lib/libfmtd.a
vcpkg_installed/x64-linux/debug/lib/libvorbis.a
vcpkg_installed/x64-linux/debug/lib/libogg.a
-ldl
vcpkg_installed/x64-linux/debug/lib/libSDL2d.a
-ldbus-1  -Wl,--no-undefined  -pthread
vcpkg_installed/x64-linux/debug/lib/libfreetyped.a
vcpkg_installed/x64-linux/debug/lib/libbz2d.a
vcpkg_installed/x64-linux/debug/lib/libpng16d.a
vcpkg_installed/x64-linux/debug/lib/libz.a
-lm
vcpkg_installed/x64-linux/debug/lib/libbrotlidec-static.a
vcpkg_installed/x64-linux/debug/lib/libbrotlicommon-static.a

It’s a linking problem. I don’t know how cmakes target_link_libraries work so
I’m not sure how it actually works.

I can’t really say anything without knowing what arguments are actually
supplied to the compiler by cmake. I have no experience with cmake so I don’t
think I can help you with cmake related things.

Adding -lmpg123 -lvorbisfile as arguments to the compiler should work
(assuming you have them installed)