Bug 235557 - audio/sdl2_mixer: Mix_LoadMUS() doesn't work after 2.0.4 update
Summary: audio/sdl2_mixer: Mix_LoadMUS() doesn't work after 2.0.4 update
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dmitry Marakasov
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2019-02-06 16:42 UTC by Jan Beich
Modified: 2019-02-08 20:22 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (amdmi3)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2019-02-06 16:42:19 UTC
$ fetch https://people.xiph.org/~xiphmont/demo/surround/6.ogg
$ cat >a.c
#include <SDL_mixer.h>

int main()
{
  if (!Mix_LoadMUS("6.ogg"))
    return 1;

  return 0;
}

$ cc a.c $(pkg-config SDL2_mixer --cflags --libs)
$ ./a.out; echo $?
1

One of my ports actually checks something like this during configure:
http://package19.nyi.freebsd.org/data/112amd64-default-build-as-user/492276/logs/errors/ponscripter-sekai-0.0.6_6.log
Comment 1 Jan Beich freebsd_committer freebsd_triage 2019-02-06 17:31:25 UTC
https://hg.libsdl.org/SDL_mixer/rev/92882ef2ab81 is the first bad.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2019-02-06 18:17:00 UTC
Mix_GetError() returns "Unrecognized audio format". After poking other consumers it seems Mix_OpenAudio() is required.
Comment 3 Jan Beich freebsd_committer freebsd_triage 2019-02-06 18:23:08 UTC
Alas, Mix_OpenAudio() doesn't work in a poudriere jail as /dev/dsp is hidden.
Comment 4 Dmitry Marakasov freebsd_committer freebsd_triage 2019-02-07 13:58:42 UTC
- SDL2_Mixer documentation clearly says:

> int Mix_OpenAudio
> ...
> Initialize the mixer API.
> This must be called before using other functions in this library.

- It seems pretty legit to me that the mixer initialization would require a device present

- It's also obvious that the device is not obliged to be present at build time

Summarizing, it looks like it's problem of ponscripter-sekai, which should not check for SDL_mixer support this way. This may be fixed by removing whole `Checking for system SDL_mixer...` if block in configure. And it should be reported upstream.
Comment 5 Dmitry Marakasov freebsd_committer freebsd_triage 2019-02-08 20:22:21 UTC
Upstream issue: https://github.com/sekaiproject/ponscripter-fork/issues/92

Fixed by forcing the broken configure check to always pass.
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-02-08 20:22:45 UTC
A commit references this bug:

Author: amdmi3
Date: Fri Feb  8 20:21:44 UTC 2019
New revision: 492445
URL: https://svnweb.freebsd.org/changeset/ports/492445

Log:
  - Fix build after SDL2_Mixer update

  Don't try to check for SDL2_Mixer at configure phase by trying to
  run program which tries Mix_LoadMUS.

  First, the program is incorrect as per SDL2_Mixer documentation,
  one is not allowed to call any SDL2_Mixer functions without first
  calling Mix_Init() (which is not called).

  Next, calling any mixer functions may involve opening audio device,
  which may not be present on the machine where the package is built.

  Fix by forcing the broken check to pass.

  PR:		235557
  Reported by:	jbeich@FreeBSD.org
  Approved by:	portmgr blanket (build fix)
  Upstream issue:	https://github.com/sekaiproject/ponscripter-fork/issues/92

Changes:
  head/games/ponscripter-sekai/files/patch-configure