Static Linking Linux 4.4.2
AceBlkwell

Edgar,

I thought I had statically linked my game in Linux. I found out when I tested the binary files on another machine that I hadn't I guess playing on a machine that had Allegro 4.4.2 installed allows the binary to run.

You worked with me on my Windows link. I tried using the same list of files but obviously didn't work. Can you (or anyone) help me with the list of libraries needed to statically link my Linux program.

Thanks
Ace

Edgar Reynaldo

On Linux, you want to use pkg-config to link allegro whether it is statically or dynamically.

Here are some various invocations of pkg-config you can use - the first two should work for you (at compile to object, and at link stage) :

`pkg-config --cflags --static allegro_monolith-debug-static-5`
`pkg-config --libs --static allegro_monolith-debug-static-5`
`pkg-config --Cflags allegro_monolith-5`
`pkg-config --libs allegro_monolith-5`

An example would be :

g++ -Wall -Wextra -Wshadow -g -o Main -I `pkg-config --cflags --static allegro_monolith-debug-static-5` Main.cpp Object1.cpp Etc.cpp `pkg-config --libs --static allegro_monolith-debug-static`

AceBlkwell

Thx Edgar. I don’t usually run from the prompt so I’ll have to see how that works with Eclipse IDE.

Ace

Edgar Reynaldo

You only need a command prompt to get the libraries you need to link to statically, and the compile flags for static allegro, like -DALLEGRO_STATICLINK.

Go to a terminal and type this :

echo `pkg-config --flags --libs --static allegro_monolith-debug-static-5`

Then take what you need from that and enter it into your eclipse project : I downloaded eclipse to try it out and these seem to be the proper places to put your commands :

{"name":"611108","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/b\/3bee0f7d46c65bdda926d9c216504927.png","w":968,"h":1007,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/b\/3bee0f7d46c65bdda926d9c216504927"}611108
{"name":"611109","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/a\/faf32e1ac3aa73ff5386abe78caa61c4.png","w":977,"h":1009,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/a\/faf32e1ac3aa73ff5386abe78caa61c4"}611109

Thread #617121. Printed from Allegro.cc