Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Make a static distribution of Allegro 5 in Windows 10

This thread is locked; no one can reply to it. rss feed Print
Make a static distribution of Allegro 5 in Windows 10
Eric Johnson
Member #14,841
January 2013
avatar

Hi there,

I'm a Linux user who is looking to distribute a Windows version of my KrampusHack 2016 game. Thanks to some friendly replies on my last thread, I was able to make a static distribution for Linux. Now I want to do the same for Windows.

The thing is though, I haven't the faintest idea how to do that on Windows. Which compiler and IDE would you recommend using to compile Allegro 5 games on Windows? And how would I statically link it? I haven't used Allegro with Windows in a LONG time.

Thank you for your time. :)

Edit
I downloaded and installed Code::Blocks with MinGW (from the Code::Blocks site). I also downloaded the "MinGW 4.7.0" file for Allegro 5 from the files page of this site.

I understand that I need to set the search directory in Code::Blocks to the include directory from the Allegro download. That's fine. What about the libraries to link? What's the difference between md and mt files?

Edit #2
I'm fairly certain md is for dynamic and mt for static linking. I managed to compile a test program dynamically and it worked! :D I will now attempt to dynamically compile my game, then if that works, I will give statically linking it a go.

GullRaDriel
Member #3,861
September 2003
avatar

All by yourself :-)

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Eric Johnson
Member #14,841
January 2013
avatar

All by yourself :-)

So far, yep! :D

I've run into a bit of a snag though. Firstly, the compiler doesn't seem to know what std::stoi is:

Quote:

error: 'stoi' was not declared in this scope

No problem though; I got around this by using std::stol instead. But when I run the program, I get the following error:

Quote:

Assertion failed: vec->_itemsize > 0, file d:\Libraries\build\allegro\src\allegro-git\allegro-git\src\misc\vector.c, line 174

There are no syntax errors or any errors of any kind when compiling, so I'm not sure what to make of this run-time error. Currently, I'm only linking with liballegro-5.0.10-monolith-mt-debug.a. Should I be using something else? Any ideas what could cause this error?

Edit
Linking instead with liballegro-5.0.10-monolith-md.a results in the following error instead:

Quote:

The procedure entry point __gxx_personality_v0 could not be located in the dynamic link library C:\...\allegro=5.0.10-monolith-md.dll

Edit #2
Using liballegro-5.0.10-monolith-md-debug.a results in the same as listed in edit #1.

Edit #3
Linking with liballegro-5.0.10-monolith-mt.a works! ;D

Edit #4
The monolith files contain all of the addons, correct? So if I link against that, I won't need to link them all individually?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

You won't need to link the addons, but you will need to link a bunch of static libraries on Windows. The list is as follows :

-static -ldumb -lFLAC -lvorbisfile -lvorbis -lfreetype -logg -lpng16 -lzlibstatic -lgdiplus -luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32 -lshlwapi

Of course if you didn't use them you don't need them, but most of those windows libraries listed are mandatory.

Use dependency walker to see if your program depends on any dlls.

Also, 5.0.10 is really old, just so you know. The allegro.cc files page hasn't been updated in years.

Eric Johnson
Member #14,841
January 2013
avatar

Thanks for writing, Edgar. I decided to dynamically link my game instead, and package the dlls.

The allegro.cc files page hasn't been updated in years.

That's kind of sad, actually. :'(

Elias
Member #358
May 2000

That's kind of sad, actually.

Well, we have very up-to-date packages with every release instead now :) http://download.gna.org/allegro/allegro-bin/5.2.2/

And Edgar is providing some binaries for some other mingw versions as well!

--
"Either help out or stop whining" - Evert

Eric Johnson
Member #14,841
January 2013
avatar

Well, we have very up-to-date packages with every release instead now :)

In Linux, I keep up to date by cloning Allegro from GitHub and building it myself. But it's good to know there are recent pre-built binaries on Windows. :)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

As long as you didn't use Direct3D, you can use my binaries for MinGW 5.3.0 and Allegro 5.2.1.1. There are problems with dx9mgw.zip. I don't use the DXSDK because it's massive.

https://sourceforge.net/projects/unofficialmingw/files/MinGW5302v3.tar.7z/download

https://sourceforge.net/projects/unofficialallegro5distribution/files/Allegro5211_MinGW5302_Rel3.tar.7z/download

Allegro 5211 CHM Manual.

Go to: