- Online Community Forums » Installation, Setup & Configuration » Installation on Windows using msys2 (revised wiki article)

This thread is locked; no one can reply to it. rss feed Print
Installation on Windows using msys2 (revised wiki article)
Member #12,293
October 2010

Ok, so I decided to revise the wiki article about MSYS2 (how to install Allegro5 while getting started from scratch).
Since I cannot edit the wiki currently (didn't know, sorry), I'm posting it here. I won't bother further fixing the formatting for now. See the bottom for notes about a (I think) better CMake command.

I) Install and apply latest updates to MSYS2 base system

  1. Go to and download the installer. Pick the msys2-x86_64-... variant for a 64 bit system and the i686 variant for a 32 bit system.

  2. Run the installer. Select a path containing only plain old ASCII characters (no accents) and no spaces (!) to install to.

  3. Tick "Run msys2 now" (or rather, don't uncheck it).

  4. In the terminal window that opens, run the command pacman -Syu and confirm the update when necessary.

  5. Close the terminal window if requested, confirm if necessary.

  6. From your start menu, open the "MSYS2 MSYS" shell again (all 3 variants can be found under "MSYS 64 bit" (or "MSYS 32 bit" respectively)

  7. In the terminal window, run the command pacman -Su and confirm when necessary

Type "exit" to exit the MSYS2-shell
You now have an up-to-date MSYS2 base system.

II) Install the C/C++ compiler

I'll assume you use a 64 bit system. If you use a 32 bit system, substitute x86_64 with i686 in all the pacman invocations that follow.

  1. Open the "MSYS2 MinGW 64-bit" shell from the start menu (32-bit on a 32 bit system). This will be the one you'll be working with from now on.

  2. Run pacman -S mingw-w64-x86_64-gcc to install a C/C++ compiler. This will pull in quite some other packages.

  3. Run pacman -S mingw-w64-x86_64-gdb to install a debugger.

You now have a working C/C++ compiler and debugger.

III) Install Allegro

You have two options here. The easiest way to get started is to just install the Allegro5 distribution that comes via msys2's packages. This is usually lagging a bit behind the current Allegro version (they do have 5.2.2 right now) and only provides shared libraries. This should be okay for development, but it's usually not appropriate when you want to release your project.

You can also compile the latest version of Allegro5 yourself, which also gives you better control over the type of binaries you want (for example, a monolith dll). See below for that.

Both variants should best be thought about as being mutually exclusive.

Note that there are also official Allegro5 binaries (follow the link "Allegro 5.2 binary packages" on
These are a bit more versatile (e.g. providing static variants of the dependencies, too), but usually depend on a specific compiler version. Using them should be straightforward,
but you need to confirm that the compiler you've installed via MSYS2 is (still) compatible.

A) From MSYS2's packages

To install the Allegro 5 package from the msys2 packages, just enter:
pacman -S mingw-w64-x86_64-allegro

You will see messages about what dependency packages to install in order to use certain addons.
It looks like that on my system:

mingw-w64-x86_64-dumb: allegro_audio
mingw-w64-x86_64-flac: allegro_audio
mingw-w64-x86_64-opusfile: allegro_audio
mingw-w64-x86_64-freetype: allegro_font
mingw-w64-x86_64-libjpeg-turbo: allegro_image
mingw-w64-x86_64-libpng: allegro_image
mingw-w64-x86_64-libvorbis: allegro_audio
mingw-w64-x86_64-openal: allegro_audio
mingw-w64-x86_64-physfs: allegro_physfs

If you need the functionality, you can install any of them by pacman -S ing them. To start out, I'd recommend to install at least freetype, libjpeg-turbo and libpng.
So you would do:
pacman -S mingw-w64-x86_64-freetype
pacman -S mingw-w64-x86_64-libpng
pacman -S mingw-w64-x86_64-libjpeg-turbo

Now you can compile a simple Allegro5 program (for example, excamera.c) by running the following command in a "MSYS2 64 bit" terminal window
gcc ex_camera.c -Wall -o camera -lallegro -lallegro_font -lallegro_color -lallegro_primitives

(Note: In case of ex_camera, you will need common.c from the Allegro5 examples directory as well (these are not included in the MSYS2 package, I've just picked them as an example))
This should just work.

B) Compiling Allegro from source

  1. Remove the MSYS2-supplied package if installed
    If you want to compile Allegro5 yourself and have the Allegro5 package (supplied by MSYS2) installed, it is better to remove the MSYS2 allegro5 package beforehand by issuing
    pacman -R mingw-w64-x86_64-allegro.
    You can check which packages you have installed by running
    pacman -Q. That means
    pacman -Q | grep allegro
    should print something if their package is installed.
    You can, of course, always reinstall this version.

  2. Install make, cmake, git, and pkg-config:

    pacman -S make
    pacman -S mingw-w64-x86_64-cmake
    pacman -S git
    pacman -S mingw-w64-x86_64-pkg-config

  3. Install any of the Allegro5 dependencies you want/need (if you haven't already):

    pacman -S mingw-w64-x86_64-freetype
    pacman -S mingw-w64-x86_64-libpng
    pacman -S mingw-w64-x86_64-libjpeg-turbo
    pacman -S mingw-w64-x86_64-libvorbis  
    pacman -S mingw-w64-x86_64-flac       
    pacman -S mingw-w64-x86_64-physfs     
    pacman -S mingw-w64-x86_64-dumb       
    pacman -S mingw-w64-x86_64-libtheora  

  4. Clone the Allegro5 repository
    Run this from a (preferably empty) directory of your choice:

    git clone

    (no link emphasis intended)
    It will create an allegro5 folder with the Allegro5 source code inside.

  5. Configure Allegro5 (monolith variant - one dll)
    Run this just outside the allegro5 folder obtained by calling git:

    mkdir build_allegro_monolith
    cd build_allegro_monolith
    cmake G"MSYS Makefiles" -D"CMAKE_SYSTEM_PREFIX_PATH:PATH=/mingw64/x86_64-w64-mingw32" -DWANT_MONOLITH=on ../allegro5

    (for 32 bit systems, use

    cmake -G"MSYS Makefiles" -D"CMAKE_SYSTEM_PREFIX_PATH:PATH=/mingw32/i686-w64-mingw32" -DWANT_MONOLITH=on ../allegro5


    The part about CMAKE_SYSTEM_PREFIX_PATH is needed in order to find the DirectX libraries shipping with MSYS2.

  6. Build Allegro5

    make install

    make install should automatically pick /mingw64, i.e. C:\msys64\mingw64 as the installation prefix (or msys32/mingw32 for a 32 bit system)

IV) Running programs you built outside the MSYS2 terminal

When you want to run programs build with MSYS2 outside your terminal window, your system needs to be able to find the DLLs that reside in /mingw64/bin (for a 64 bit installation). So you'll need to add C:\msys64\mingw64\bin to your system PATH if C:\msys64 is where you installed msys2. You should take care that no other similar installation is on the path before this one.

You may find that a console window is opened even when running your program from outside the terminal. To get rid of it, pass -mwindows as a compiler flag, e.g.
gcc ex_camera.c -Wall -o camera -mwindows -lallegro -lallegro_font -lallegro_color -lallegro_primitives
gcc ex_camera.c -Wall -o camera -mwindows -lallegro_monolith


The current article on the wiki suggests to install into /mingw64/x86_64-w64-mingw32 by setting this as CMAKE_INSTALL_PREFIX
I don't think that's a good idea since this seems to be a directory for internal use only.
However, when omitting it, CMake won't find the DirectX libraries shipping with MSYS2.
Therefore, I'd suggest to adapt the CMAKE_SYSTEM_PREFIX_PATH instead.
This will make CMake find the DirectX libs without having to install to

Go to: