|
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
|
You can either link dynamically and distribute the allegro dlls with your program, or you can link statically and create a stand alone executable. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
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
|
On linux, you use pkg-config calls. g++ -Wall -O2 -o proggie `pkg-config --cflags --static allegro_monolith-5` proggie.cpp `pkg-config --libs --static allegro_monolith-5`
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
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
|
It depends on where you got allegro from. The monolith is just much easier in my opinion. Otherwise you have to list every addon you use every time you call pkg-config, which sucks. Where did you get Allegro? You're using 5 right? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
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. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
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. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
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
|
If you rebuild them (libpng and libjpeg and zlib) as static and then rebuild allegro properly, they should disappear. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|