Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Allegro 4 for Linux and OSX

This thread is locked; no one can reply to it. rss feed Print
Allegro 4 for Linux and OSX
Cisco Mir
Member #13,959
January 2012

Hello people!

About a year ago I released my first Allegro game (well, really a remake of an old game), Alley Cat Remeow Edition: https://gamejolt.com/games/alleycatremeow/327439

The game works on windows and I consider it a finished project, but some people have been asking me if I would release a version for Mac or Linux. While it was my intention in the beginning, I never got the opportunity of having my programing enviorment working on either of those systems, so I was never able to compile it for those systems.

So, I just wanted to ask: does anyone know how to compile programs for Allegro 4 on those systems, or may want to help me do so?

That would be greatly appreciated, thanks! :)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I don't own any OSX machines, so I can't help you there, but Linux is a fairly simple straightforward matter.

On Ubuntu, it's pretty easy.

sudo apt-get install liballegro4-dev

Then to compile and link with allegro 4, you use allegro-config. Type it at a prompt to see options.

g++ -Wall -Wextra -Wshadow -g -o main.out `allegro-config --cflags` main.cpp `allegro-config --libs`

EDIT
On versions of Linux that don't have packages prepared for allegro (they should all have one for Allegro 4 by now...), you can build from source using cmake.

Homebrew might have binaries for Allegro 4 on OSX.

Cisco Mir
Member #13,959
January 2012

Thanks for that fast answer! I have not much idea of linux either osx, but that is a beginning, I will try what you said!

Is there any way of compiling it so I can include the binary executable and all the needed libs in the same folder, so the user doesn't need anything appart from what he downloaded? I was aiming to be able to release only one same zip file that works on all systems, with different executables.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

yes, static link.

On Windows this is no problem, but on Linux, even if you static link, you'll still have a bunch of dependencies on system libraries. Use ldd to list them, and then copy them into your game folder. Then write a launcher script that adds this library directory to your LD_LIBRARY_PATH environment variable.

g++ -Wall -g -o main.out `allegro-config --static --cflags` main.cpp `allegro-config --static --libs`

export LD_LIBRARY_PATH=libdir/:$LD_LIBRARY_PATH

Cisco Mir
Member #13,959
January 2012

Thank you very much! I will give it a try! :)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: