Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » [4.4, Linux] static linking => no sound

This thread is locked; no one can reply to it. rss feed Print
[4.4, Linux] static linking => no sound
SimonN
Member #8,272
January 2007
avatar

Hi. I use Linux (Debian 6) and have tried this with both Allegro 4.2 and Allegro 4.4. In the following description, "the library" stands for either one of those.

I have compiled the library both as a shared lib and a statically linked lib. When I link with $(allegro-config --libs), the shared one gets used. When I link with $(allegro-config --libs --static), the static lib gets used, as intended.

I initialize the sound with install_sound(DIGI_AUTODETECT, MIDI_NONE, 0) and later play back samples. When I link dynamically, everything works, the call to install_sound returns 0 as expected, and I hear samples being played. When I link statically, however, I get no sound at all, even though the call still returns 0.

I have tried DIGI_ALSA, which doesn't change anything: In both cases, the call returns 0, but I get sound only when linking dynamically.

(If necessary, I can throw together a full test program, but it's basically this call, a sample load, and a playback.)

Anyone have an idea why I lack sound when linking statically, or what I could try? (I found this exact problem in one or two threads on the internet, but nobody had a solution there; the forums weren't Allegro-related though.)

On my system, $(allegro-config --libs --static) expands to -L/usr/lib -lalleg -lm -lXxf86vm -lXcursor -lXpm -lXext -lX11 -lpthread -ldl, and I get no linker errors.

-- Simon

Niunio
Member #1,975
March 2002
avatar

Try to run the demo game from console and tell if it shows an error saying: "Insufficent digital voices available".

-----------------
Current projects: Allegro.pas | MinGRo

SimonN
Member #8,272
January 2007
avatar

Thanks for the tip, I'll try it soon with a clean static Allegro recompilation, and post results. (Currently using A 4.2 from package manager, the example game is dynamically linked there.)

==========================================

Okay, I've cleanly uninstalled 4.2 and then rebuilt Allegro 4.4 statically.

The example game (shooter) runs with sound. Also, exsample runs nicely and plays back the sample, showing ALSA as the driver in use.

However, when I recompile exsample myself via gcc exsample.c $(allegro-config --libs --static), I don't get any sound again. It shows a blank string for the used driver, but the call to install_sound succeeds nonetheless. The call to allegro-config produces as output -L/usr/local/lib -lalleg -lm -lpthread -lSM -lICE -lX11 -lXext -lXext -lXcursor -lXcursor -lXxf86vm -lasound -ljack -lpthread -lrt -lXxf86dga -lSM -lICE -lX11 -lXext -ldl.

I plowed through the convoluted cmake-generated makefiles, trying to see what they do differently than me, but I didn't get any smarter from them >_>

-- Simon

Niunio
Member #1,975
March 2002
avatar

Actually I asked you because I have the same problem, but using dynamic linking, and I have no tips about what's the problem. :-[ If you can fix it then it will help me too. ;)

-----------------
Current projects: Allegro.pas | MinGRo

Go to: