Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » How do you make using the allegro library simple for the user ?

This thread is locked; no one can reply to it. rss feed Print
How do you make using the allegro library simple for the user ?
taiwing
Member #16,774
December 2017

Hello,

I almost finished writing my game, and now I'm focusing on testing it on other machines than mine. So I'm wondering how do you handle the allegro library in your projects for the users.

For now the user has to independently install the library himself, but I'd like to make it simpler. Is there a way to make an automated installation ? I'm thinking shell script, or maybe in the makefile, but I don't know if that's the best way to do it. Or maybe to turn the library static to just have a single executable at the end ?

What do you think is the best way ?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

taiwing
Member #16,774
December 2017

Do you know how to statically link allegro on linux, or maybe have a resource on the subject ? I'm kind of a noobie on the all linking thing.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

taiwing
Member #16,774
December 2017

I'm using C, but I guess the command is the same with gcc isn't it ?

Also I can't find the monolith version of the library. Do I have to recompile allegro myself ?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

taiwing
Member #16,774
December 2017

Yes I have allegro 5, and I do list every package in the gcc command (you're right, that was a pain, but since I use a makefile, it doesn't matter much).

I installed it by following the debian tutorial here.

EDIT: I used your command but linking every addon instead of the monolith, and tried to execute the file on a another computer without allegro, but it didn't work.

It gave me this error:

./tetris: error while loading shared libraries: liballegro_primitives.so.5.0: cannot open shared object file: No such file or directory

It still is dynamically linked, which I'm guessing is because I only have the .so versions of the library and the source.
Also, I tried to recompile allegro with "-DWANT_MONOLITH=on" to get the monolith version, but it was just ignored by cmake.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Try putting --static before --libs. And if that fails, try putting "-static" before pkg-config linker command.

`pkg-config --static --libs allegro_monolith-5`

However, static linking on Linux is a nightmare. The one thing Linux fails at is portability.

taiwing
Member #16,774
December 2017

Ok thanks, I managed to rebuild allegro to get the static linux files (with the cmake option -DSHARED=off).

You were right, it wasn't easy and "out of the box", and there are still dependencies like libpng and libjpeg I had to install on the other machine, but it works.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: