Static Linking with Allegro 4 in Linux
AceBlkwell

Edgar,

You were kind enough to help me with the Window static linking. And you actually tried to help with the Linux static linking before. But I was busy at the time and couldn't implement it and once I got back to it, the thread was gone.

To the point, can you help me with the static linking of my program for Linux? I'm using the 4.2 (I think) in Linux. I appreciate any input you would have.

Thanks

Neil Roy

Just put #define ALLEGRO_STATICLINK at the top of your source code, then link with the static version of the library. That's it.

AceBlkwell

Neil,

Thanks. I thought that all there should be to it but the windows version required about 15 libraries included.
I compiled my Allegro Linux version with the static option. Do you know what the static library would be called? just liballeg.so?

Neil Roy

On my system it's liballeg_s for the static version. Been a while since I used them.

Edit: and liballd_s for the static debug version.

AceBlkwell

Neil Thanks. I'll give it a try. BTW why haven't you used them much. Graduated on to A5? Or just don't static link much? Or don't use Linux? Just curious.

Thanks again,

Edgar Reynaldo

Those 'extra' libraries are all the system and dependencies that allegro uses...

So they're different on Windows and Linux.

Allegro 4 uses allegro-config on Linux.

Neil Roy

I don't use Linux, and yeah, if I code on Allegro, I use the latest version of Allegro 5. But I haven't done much programming at all lately except some modern OpenGL stuff.

My Deluxe Pacman 1 game is Allegro 4, and my Deluxe Pacman 2 game is Allegro 5 (links in my sig, free games). While there are some aspects of Allegro 4 that I prefer, overall Allegro 5 is far superior.

AceBlkwell

Well, I just realized my previous static creation of 4.4.2 is gone. I've since went from Slackware 14.1 to 14.2. To the point I don't have the static libraries anymore. I can't remember how I compiled it last time. Does any one have the line commands or config file flags I need to set to get 4.4.2 static libraries?

Thanks

Edgar Reynaldo

For Allegro 4.4, you build it with CMake. You'll want to install ogg and vorbis for the logg addon, and libpng and zlib for the loadpng addon.

It's best to use cmake-gui to configure everything by hand, because the CMake script to build allegro is not the smartest when it comes to finding things.

AceBlkwell

Thanks Edgar, From what I read CMake and QT are Windows based. Am I misunderstanding? Also I found a version of allegro with the needed liballeg_s file on my jump drive. Is this a common file for both Windows and Linux, or is it unique to Linux. I may not have to worry about recompiling as I may have my original copy I compiled before.

thanks

Edgar Reynaldo

Thanks Edgar, From what I read CMake and QT are Windows based. Am I misunderstanding? Also I found a version of allegro with the needed liballeg_s file on my jump drive. Is this a common file for both Windows and Linux, or is it unique to Linux. I may not have to worry about recompiling as I may have my original copy I compiled before.

thanks

CMake is cross platform. Install it with apt or zypper or whatever Slackware uses for a package manager, command line or GUI based or whatever.

As an alternative to cmake-gui, you can use ccmake, but I hate TUIs so I will never use it. cmake-gui is just easier, but you may have to install GTK along with it.

liballeg_s.a is a static version of Allegro, yes, but if you build allegro yourself, it will be called liballeg.a .

You can't use the same lib for Windows and Linux. They are incompatible, even if you build it with gcc.

Allegro 4.4 uses allegro-config. I've never used it before, so I don't know how it works, but I think it's pretty similar to pkg-config. If you call it without arguments, it should output help text.

Thread #617262. Printed from Allegro.cc