Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake can't link to libmpg123 when building with sdl2-mixer #22023

Closed
sharkwouter opened this issue Dec 14, 2021 · 5 comments · Fixed by #22049
Closed

CMake can't link to libmpg123 when building with sdl2-mixer #22023

sharkwouter opened this issue Dec 14, 2021 · 5 comments · Fixed by #22049
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@sharkwouter
Copy link

I have 2 projects which are based on sdl2 which use sdl2-mixer and produce automatic builds for Windows. Since this issue #21776 this hasn't worked. A fix has been applied which makes sdl2-mixer build again with libmpg123 support, but my builds, which were working before, are still not working. I changed nothing.

Here is a link to the build: https://github.com/JoseTomasTocino/freegemas/runs/4520681620?check_suite_focus=true

I'm building on windows-latest in github actions. I'm getting the following error:

main.cpp
Generating Code...
LINK : fatal error LNK1104: cannot open file 'MPG123::libmpg123.lib' [D:\a\freegemas\freegemas\freegemas.vcxproj]
Error: Process completed with exit code 1.

This is my workflow:

  Windows:
    runs-on: windows-latest

    steps:
      - name: Install dependencies
        run: |
          vcpkg install --triplet x64-windows sdl2 sdl2-image[libjpeg-turbo] sdl2-ttf sdl2-mixer[libvorbis,mpg123] jsoncpp
      - name: Checkout
        uses: actions/checkout@v2
      - name: Build
        run: |
          cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -D-DVCPKG_TARGET_TRIPLET=x64-windows -A x64 .
          cmake --build . --config Release

The relevant part of my CMakeLists.txt can be found here: https://github.com/JoseTomasTocino/freegemas/blob/ea416c4594b3e0a97e594e4968d000f70ff198c6/CMakeLists.txt#L121-L152

There is probably an error in one of the cmake files shipped with sdl2-mixer, but I did not extensively troubleshoot this.

@sharkwouter
Copy link
Author

I can reproduce this on Windows 10 as well when I use the same code and and commands on a clean vcpkg.

@JackBoosY JackBoosY assigned LilyWangLL and unassigned JackBoosY Dec 15, 2021
@LilyWangLL LilyWangLL added the category:port-bug The issue is with a library, which is something the port should already support label Dec 15, 2021
@LilyWangLL
Copy link
Contributor

@sharkwouter Could you test PR #22049 is useful for you? Thanks.

@sharkwouter
Copy link
Author

Done, it does fix this issue

@mice2100
Copy link

mice2100 commented Jan 15, 2022

Error when install sdl2-mixer:
vcpkg install sdl2-mixer[mpg123]:x64-mingw-dynamic

Log says:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/SDL2_mixer.dir/music_mpg123.c.obj:music_mpg123.c:(.rdata$.refptr.mpg123_seek[.refptr.mpg123_seek]+0x0): undefined reference to mpg123_seek' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/SDL2_mixer.dir/music_mpg123.c.obj:music_mpg123.c:(.rdata$.refptr.mpg123_replace_reader_handle[.refptr.mpg123_replace_reader_handle]+0x0): undefined reference to mpg123_replace_reader_handle'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/SDL2_mixer.dir/music_mpg123.c.obj:music_mpg123.c:

@JackBoosY
Copy link
Contributor

@mice2100 Please open a new issue to report that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants