Help needed: Sound_Init 'hangs'; what's wrong with this code?

Hello all,

When compiling the Maze of Galious remake
(http://www.braingames.getput.com/mog/default.asp) on my SuSE 8.2 machine I
stumbled into some trouble with the sound initialization. When calling
Sound_Init my machine spends 100% CPU time on I don’t know what, but the game
simply isn’t working. I’ve been assured by the developer that it works under
Windows and MacOS, and that he has email from a friend who has it working
under Red Hat. Hence I wonder if SuSE did something with the SDL libraries or
if it’s something else.

I’ve included a stripped makefile and code showing the problem. I’ve used gdb,
but as I can’t see within the Sound_Init execution I cannot figure out what
might go wrong. Anyone willing to have a look?

Regards,

Pieter Hulshoff
-------------- next part --------------
A non-text attachment was scrubbed…
Name: main.cpp
Type: text/x-c++src
Size: 1352 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030602/e6afb44f/attachment.cpp
-------------- next part --------------
A non-text attachment was scrubbed…
Name: Makefile
Type: text/x-makefile
Size: 431 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030602/e6afb44f/attachment.bin

Hi,

well, that was an unpleasant experience!

I’m afraid that you are SOL in getting SDL_sound and SDL_mixer to
work together, unless you remove MikMod support from one of them.

I get exactly the same problem as you on my SuSE 7.3 installation
and I quickly narrowed the problematic code down to the initialization
of libmikmod in SDL_sound.

After instrumenting SDL_sound, libmikmod (which SDL_sound
dynamically links to) and the test program I just kept getting
bizarre results:

Everything would be going well, and then with a call into
MikMod everything would just vanish (printf not working!) and then reappear
when back in SDL_sound.

I then went on a versioning wild goosechase…

Hours later when this behaviour swapped round, and all I was
getting were the previously missing messages but not the others:
the light dawned and I checked the mikmod code in SDL_mixer.

I think that SDL_mixer and SDL_sound (via libmikmod) both 'export’
a set of identical functions e.g.:

MikMod_Init()
MikMod_RegisterAllLoaders()
MikMod_UnregisterAllLoaders()

and which set gets called depends on the .so loading order.

Presumably the ones in SDL_mixer could be hidden, but a temporary
solution would be to build your own version of SDL_mixer without
mikmod support (there is a MOD_MUSIC #define).

I didn’t try it on windows, but I wouldn’t be surprised if it worked
since the exports in a DLL are usually tightly controlled, and there
would be no conflict,

cheers,
John.> ----- Original Message -----

From: phulshof@xs4all.nl (Pieter Hulshoff)
To:
Sent: Monday, June 02, 2003 11:51 AM
Subject: [SDL] Help needed: Sound_Init ‘hangs’; what’s wrong with this code?

Hello all,

When compiling the Maze of Galious remake
(http://www.braingames.getput.com/mog/default.asp) on my SuSE 8.2 machine
I
stumbled into some trouble with the sound initialization. When calling
Sound_Init my machine spends 100% CPU time on I don’t know what, but the
game
simply isn’t working. I’ve been assured by the developer that it works
under
Windows and MacOS, and that he has email from a friend who has it working
under Red Hat. Hence I wonder if SuSE did something with the SDL libraries
or
if it’s something else.

I’ve included a stripped makefile and code showing the problem. I’ve used
gdb,
but as I can’t see within the Sound_Init execution I cannot figure out
what
might go wrong. Anyone willing to have a look?

Regards,

Pieter Hulshoff

Hello John,

Thanks for all your work! :slight_smile: I’ll pass the information on to the author of the
program (who should be reading this mailing list as well). I still wonder if
it’s a SuSE only issue, as he told me that a friend of his has it working on
Red Hat. I’ll have to look closer into that one.

Kind regards,

Pieter Hulshoff

Hi,

just tried it on Gentoo with a different compiler (3.2.2
instead of 2.95.3) and it behaves the same - I don’t think
it’s a SuSE problem.

In addition to building either SDL_mixer or SDL_sound
without support for mod files, it would (presumably) be possible
for SDL_sound to statically link to libmikmod which might
also fix the problem - I will try it later.

… he told me that a friend of his has it working on Red Hat.

If possible, get his friend to run ‘ldd’ on the libraries e.g.

ldd /usr/lib/libSDL_mixer.so

which on Gentoo produces (slightly edited):

libvorbisfile.so.3 => /usr/lib/libvorbisfile.so.3 (0x40056000)
libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x4005d000)
libogg.so.0 => /usr/lib/libogg.so.0 (0x4007d000)
libsmpeg-0.4.so.0 => /usr/lib/libsmpeg-0.4.so.0 (0x40081000)
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x400ea000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40164000)
libc.so.6 => /lib/libc.so.6 (0x401b5000)
libm.so.6 => /lib/libm.so.6 (0x402e6000)
libstdc++.so.5 => /usr/lib/gcc-lib/…/libstdc++.so.5 (0x40309000)
libgcc_s.so.1 => /usr/lib/gcc-lib/…/libgcc_s.so.1 (0x403d4000)
libasound.so.2 => /usr/lib/libasound.so.2 (0x403dd000)
libdl.so.2 => /lib/libdl.so.2 (0x4047d000)
libartsc.so.0 => /usr/kde/3.1/lib/libartsc.so.0 (0x40480000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40486000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40567000)
libvga.so.1 => /usr/lib/libvga.so.1 (0x40577000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

and

ldd /usr/local/lib/libSDL_sound.so

which on Gentoo produces (slightly edited):

libdl.so.2 => /lib/libdl.so.2 (0x4004e000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40051000)
libasound.so.2 => /usr/lib/libasound.so.2 (0x400a2000)
libartsc.so.0 => /usr/kde/3.1/lib/libartsc.so.0 (0x40142000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40149000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4022a000)
libvga.so.1 => /usr/lib/libvga.so.1 (0x4023a000)
libogg.so.0 => /usr/lib/libogg.so.0 (0x402aa000)
libFLAC.so.4 => /usr/lib/libFLAC.so.4 (0x402ae000)
libsmpeg-0.4.so.0 => /usr/lib/libsmpeg-0.4.so.0 (0x402e1000)
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x4034a000)
libmikmod.so.2 => /usr/lib/libmikmod.so.2 (0x403c4000)
libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x40403000)
libm.so.6 => /lib/libm.so.6 (0x40423000)
libvorbisfile.so.3 => /usr/lib/libvorbisfile.so.3 (0x40446000)
libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x4044d000)
libc.so.6 => /lib/libc.so.6 (0x40536000)
libstdc++.so.5 => /usr/lib/gcc-lib/…/libstdc++.so.5 (0x40667000)
libgcc_s.so.1 => /usr/lib/gcc-lib/…/libgcc_s.so.1 (0x40732000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

note that libSDL_sound links to libmikmod.

Also, run the test applications ‘playsound’ for SDL_sound and
’playmus’ for SDL_mixer. They make it easy to determine if mikmod
is enabled or not - just try playing a ‘.mod’ file.

This should help confirm what is going on,

cheers,
John.> ----- Original Message -----

From: phulshof@xs4all.nl (Pieter Hulshoff)
To:
Sent: Tuesday, June 03, 2003 5:44 AM
Subject: Re: [SDL] Help needed: Sound_Init ‘hangs’; what’s wrong with this
code?

Hello John,

Thanks for all your work! :slight_smile: I’ll pass the information on to the author of
the
program (who should be reading this mailing list as well). I still wonder
if
it’s a SuSE only issue, as he told me that a friend of his has it working
on
Red Hat. I’ll have to look closer into that one.

Kind regards,

Pieter Hulshoff


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl