My message got bounced because the attached tarball made it too big,
so I’m sending it without the tarball. The contents of main.c are in
the body of the message anyway. I’d be happy to send the tarball
off-list to anyone who wants it.
DSB---------- Forwarded message ----------
From: @David_Bruce (David Bruce)
Date: Thu, Mar 4, 2010 at 2:28 PM
Subject: Re: [SDL] Unexpected exit at first SDL_mixer call (v1.2.11 in
To: SDL Development List
I made a test case program for the problem I have been having with
SDL-mixer-1.2.11 in a cross-compiled program. ?Basically, since
tuxtype uses autotools, I used the “amhello” example bundled with
automake and added enough code to try to initialize SDL and SDL-mixer.
?I copied the relevant portions of tuxtype’s configure.ac into
amhello’s configure.ac to handle detection and linking of the needed
libraries. ?The contents of main.c are below. ?Also, I have attached
the source tree of this small program in tarball form.
The crossbuild was done on an Ubuntu 9.10 machine using the
ming-cross-env environment (http://mingw-cross-env.nongnu.org), which
produces a statically linked binary instead of using dlls.
When compiled for linux, all of the output is as expected. ?On
windows, it is very puzzling. ?If I comment out the call to
Mix_OpenAudio(), the output is as expected (redirected into stdout.txt
as seems usual on Windows). ?This includes output confirming that
Mix_Init() succeeded. ?However, if Mix_OpenAudio() gets called, the
program only produces zero-byte stdout.txt and stderr.txt files, not
even containing the output of the printf statements that preceded
I hope someone has some ideas, as I am really at a loss how to proceed further.
As always, thanks!
Contents of main.c:
int main(int argc, char *argv)
?puts (“Hello World!”);
?puts ("This is " PACKAGE_STRING “.”);
?/* Begin SDL and SDL_mixer init code from tuxtype: */
?printf( “LibInit():\n-About to init SDL Library\n” );
?/* Initialize video: /
?if (SDL_Init(SDL_INIT_VIDEO) < 0)
? ?printf(“Couldn’t initialize SDL: %s\n”,
? ? ? ? ? SDL_GetError());
?/ Initialize audio: */
?if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
? ?printf(“Couldn’t initialize SDL Sound: %s\n”,
? ? ? ? ? SDL_GetError());
?printf(“SDL video and audio initialized\n”);
?/* Only call Mix_Init() if available, i.e. version >= 1.2.10 */
?printf(“About to call Mix_Init():\n”);
?initted = Mix_Init(MIX_INIT_OGG);
?/* We must have Ogg support to have sound: */
?if((initted & MIX_INIT_OGG) != MIX_INIT_OGG)
? ?printf(“Mix_Init: Failed to init required ogg support!\n”);
? ?printf(“Mix_Init: %s\n”, Mix_GetError());
?printf(“Mix_Init() not detected by configure script.\n”);
?/* If Mix_Init() succeeded (or wasn’t required), set audio parameters: */
?printf(“About to call Mix_OpenAudio():\n”);
// NOTE: if the next statement is commented out, the program
// produces the expected output on both Linux and Windows,
// but if the Mix_OpenAudio() call takes place,
// the Windows build produces no output, even from the above printf’s.
// I don’t understand this.
?if(Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 1, 2048) == -1)
? ?printf(“Warning: Mix_OpenAudio() failed\n”);
? ?printf(“Mix_OpenAudio() successful\n”);