Ubuntu and Allegro 5

From Allegro Wiki
Jump to: navigation, search

Ubuntu Instructions

From Git see: Install Allegro5 From Git/Linux/Debian

Is wise to update first before installing the needed packages:

$ sudo apt-get update

To install the very minimum to compile, do:

$ sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev cmake build-essential make libxcursor-dev

If you want all the cool stuff like jpg, png, ogg, music support, etc, run this command to install all the libraries needed:

$ sudo apt-get install -y cmake g++ freeglut3-dev libxcursor-dev libpng12-dev libjpeg-dev libfreetype6-dev libgtk2.0-dev libasound2-dev libpulse-dev libopenal-dev libflac-dev libdumb1-dev libvorbis-dev libphysfs-dev

Then, build Allegro from the directory you extracted the source code to:

$ cd allegro5
$ mkdir build
$ cd build
$ cmake ..
# or run cmakegui ..
$ make
$ sudo make install

If you're able to compile your code but the executable complains about not finding some libraries, you'll need to create links to them:

$ sudo ldconfig

If you want to compile an Allegro 5 C++ application:

You can run:

$ g++ [source file(s)] -o [output] `pkg-config --libs allegro-5.0`

There are, of course, many more Allegro 5 add-ons (check out pkg-config --list-all | grep allegro)

Error with libGL.so

If you receive a libGL.so error on Ubuntu, try to recreate the symbolic link in order to compile.

Check to see if the reported file exists (in the error that cmake gave). In my case the path is /usr/lib/i386-linux-gnu/libGL.so, remember to change the path by the one reported by your system.

$ ls -l /usr/lib/i386-linux-gnu/libGL.so

If it is a broken link, follow the links until you find the real file, then recreate the links.

Locate the real file, i.e (again, replace with the broken file in your system)

$ locate -i libGL.so.1

and then do the symlink

this is a example, put your real path in your system, remember that it won't always be in the same place

$ sudo ln -s /usr/lib/libGL.so.1 /usr/lib/i386-linux-gnu/mesa/libGL.so.1

Then, attempt to compile again.

In my case, the broken chain of links was:

/usr/lib/i386-linux-gnu/libGL.so -> mesa/libGL.so
mesa/libGL.so -> libGL.so.1

so I located the real libGL.so.1

$ locate -i libGL.so.1

and did the proper link

$ sudo ln -s /usr/lib/libGL.so.1 /usr/lib/i386-linux-gnu/mesa/libGL.so.1