The Allegro Wiki is migrating to github at https://github.com/liballeg/allegro_wiki/wiki
This page is out of date
This page is severely dated and has been superceded by the following page as of August 6th, 2017.
These instructions are correct as of the 4.4.x release of Allegro, other releases may have different dependencies. You will need:
- MinGW (http://sourceforge.net/projects/mingw/)
- Allegro source and a DirectX SDK (download from http://alleg.sourceforge.net/wip.html)
- zlib and libpng (download from http://tjaden.strangesoft.net/loadpng/mingw.html)
- libogg and libvorbis Vorbis packages (download from http://xiph.org/downloads)
- MSYS (download from http://www.mingw.org/wiki/msys)
- CMake (download from http://www.cmake.org/)
Get MinGW (http://sourceforge.net/projects/mingw/) and install it. You can use this with many modern compilers such as Dev-Cpp or CodeBlocks. Installing it to the root of a file system (ie. c:\mingw) will make things easier. Allegro in Windows requires a DirectX SDK. Get one of them from http://alleg.sourceforge.net/wip.html. Ie. download dx70_mgw.zip and extract its contents to your MinGW install path (ie. c:\mingw), allowing files to be overwritten. This must be done in order for Allegro to build later.
Get the zlib and libpng packages (http://tjaden.strangesoft.net/loadpng/mingw.html). Make sure they install to your MinGW installation directory and NOT to a subfolder, otherwise the source files won't get stored in the right folders and Allegro's CMake will not find them.
Get MSYS (http://www.mingw.org/wiki/msys). MSYS 1.0.11 is an older version, but it works just fine and includes all parts in one installer, making it very easy to install. Install it and give it the correct path to your MinGW installation directory. Remember to use the forward slash / instead of backward slash \ between each directory. Allow it to run the post install process.
Get the libogg and libvorbis Vorbis libraries (http://xiph.org/downloads). Extract each someplace WITHOUT spaces in the folder path and then use MSYS to build each. Libogg has to be built first. If you extracted libogg to c:\libogg, launch MSYS, change to the right directory with:
- cd /c/libogg
Run the configure script, specifying the path to your MinGW installation. If MinGW was installed to C:\mingw, that makes it:
- ./configure --prefix=/c/mingw
Then run this command in the same directory:
And this command in the same directory:
- make install
If you used the prefix correctly in the call to the configure script above, libogg will be properly built and the files will be correctly copied to within your MinGW folder. Change directory to the extracted libvorbis files, for example:
- cd /c/libvorbis
And run the same three commands in the same order:
- ./configure --prefix=/c/mingw
- make install
That is all we need to use MSYS for, it can now be closed. The rest of these steps will be done from the regular command window.
Get CMake (http://www.cmake.org). Install it and ensure that CMake's "bin" folder is in your PATH environment variable, so you can call cmake from any current working directory.
Get Allegro's source (http://alleg.sourceforge.net/wip.html) and extract it someplace easy to get to (such as the root of a filesystem, such as c:\allegro). Open a command shell, change to the Allegro/build directory, ie:
- cd c:
- cd c:\allegro\build
Run CMake to create the appropriate makefiles and ensure dependencies are accounted for:
- cmake -G "MinGW Makefiles" ..
Do include the two periods at the end, which refer cmake to the "CMakeLists.txt" file in the parent folder (c:\allegro). This should create the files necessary in the build folder to build Allegro itself with make after this step is completed. If you had tried to cmake Allegro before putting all of these dependencies in place, delete your "CMakeCache.txt" file and try cmake again. If this CMakeCache.txt file is in the allegro folder, make sure it's deleted, or else CMake won't put the files in the \build folder. If you installed zlib and libpng to the correct directory, and built the vorbis files correctly, you should see that it says it found ZLIB, PNG and VORBIS among the other libraries that come with Allegro.
Now Allegro itself can be built. You will need to make sure that you have defined the MINGDIR environment variable to be set to the path of your MinGW installation, and MinGW's \bin\ folder should be in your PATH environment variable, or this next part might fail to work. While still in Allegro's \build directory, run these commands:
- mingw32-make install
Notes: Some earlier versions of Allegro (ie. version 4.22) had some strange problems that would make Allegro fail to CMake and/or make. Try the latest stable release, which fixes this problem. Otherwise you may have to update part of the Allegro package (apparently binutils was the culprit).