FS#56303 - [sdl2_mixer] version 2.0.2 is broken - Mix_Init always fails
Attached to Project:
Arch Linux
Opened by Andrei Alexeyev (Akari) - Saturday, 11 November 2017, 23:47 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Monday, 20 November 2017, 03:23 GMT
Opened by Andrei Alexeyev (Akari) - Saturday, 11 November 2017, 23:47 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Monday, 20 November 2017, 03:23 GMT
|
Details
Description:
SDL_mixer 2.0.2 always fails to initialize, thus every program that depends on it has no sound output. Additional info: * package version(s): 2.0.2 * upstream bug: https://bugzilla.libsdl.org/show_bug.cgi?id=3929 * Appears to have been fixed upstream: https://hg.libsdl.org/SDL_mixer/rev/7fa15b556953 * 2.0.1 is unaffected Steps to reproduce: cc mixtest.c `pkg-config SDL2_mixer --libs --cflags` -o mixtest && ./mixtest This should print "Mix_Init() failed:" (with an empty error message), and exit with code 1. With a working SDL2_mixer, this program will produce no output and exit cleanly. Attached: mixtest.c |
This task depends upon
Closed by Sven-Hendrik Haase (Svenstaro)
Monday, 20 November 2017, 03:23 GMT
Reason for closing: Not a bug
Monday, 20 November 2017, 03:23 GMT
Reason for closing: Not a bug
$ cc mixtest.c -L/usr/local/lib/ -I /usr/local/include/SDL2 -lSDL2_mixer -lSDL2 -o mixtest
$ ./mixtest
Mix_Init() failed:
I changed your file mixtest.c
$ cc mixtest2.c -L/usr/local/lib/ -I /usr/local/include/SDL2 -lSDL2_mixer -lSDL2 -o mixtest2
$ ./mixtest2
Success SDL_AudioInit
Success Mix_Init
Attached: mixtest2.c
Try compiling the attached (and also your) file like this:
clang -Wparentheses mixtest3.c `pkg-config --libs --cflags SDL2_mixer` -o mixtest && ./mixtest
I chose clang because it gives a more descriptive warning message. This is what I get:
$ clang -Wparentheses mixtest3.c `pkg-config --libs --cflags SDL2_mixer` -o mixtest && ./mixtest
mixtest3.c:18:50: warning: & has lower precedence than ==; == will be evaluated first [-Wparentheses]
printf("(want & have == want) == %i\n", want & have == want);
^~~~~~~~~~~~~~
mixtest3.c:18:50: note: place parentheses around the '==' expression to silence this warning
printf("(want & have == want) == %i\n", want & have == want);
^
( )
mixtest3.c:18:50: note: place parentheses around the & expression to evaluate it first
printf("(want & have == want) == %i\n", want & have == want);
^
( )
mixtest3.c:19:50: warning: & has lower precedence than !=; != will be evaluated first [-Wparentheses]
printf("(want & have != want) == %i\n", want & have != want);
^~~~~~~~~~~~~~
mixtest3.c:19:50: note: place parentheses around the '!=' expression to silence this warning
printf("(want & have != want) == %i\n", want & have != want);
^
( )
mixtest3.c:19:50: note: place parentheses around the & expression to evaluate it first
printf("(want & have != want) == %i\n", want & have != want);
^
( )
2 warnings generated.
want == 16
have == 0
((want & have) == want) == 0
((want & have) != want) == 1
(want & have == want) == 0
(want & have != want) == 0
Mix_Init() failed: OGG support not available
https://github.com/taisei-project/taisei/issues/94
https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_11.html#SEC11
Attached: test cases used to confirm this.
Documentation for SDL_Init is still misleading, however (and the example contains an error). I should probably report that upstream.
mixtest_incorrect.c (0.8 KiB)