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!