Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Statically link Allegro 5 in Ubuntu?

Credits go to Elias for helping out!
This thread is locked; no one can reply to it. rss feed Print
Statically link Allegro 5 in Ubuntu?
Eric Johnson
Member #14,841
January 2013
avatar

Hi there,

I am trying to statically link Allegro 5 using pkg-config in Ubuntu. I have been using the following example program as a test:

#SelectExpand
1#include <iostream> 2 3#include <allegro5/allegro.h> 4#include <allegro5/allegro_image.h> 5#include <allegro5/allegro_primitives.h> 6 7using std::cout; 8 9int main(void) { 10 11 if (!al_init()) { 12 13 cout << "Error: failed to initialize Allegro 5.\n"; 14 15 return -1; 16 } 17 18 if (!al_init_image_addon()) { 19 20 cout << "Error: failed to initialize image addon.\n"; 21 22 return -1; 23 } 24 25 if (!al_init_primitives_addon()) { 26 27 cout << "Error: failed to initialize primitives addon.\n"; 28 29 return -1; 30 } 31 32 if (!al_install_keyboard()) { 33 34 cout << "Error: failed to install keyboard.\n"; 35 36 return -1; 37 } 38 39 ALLEGRO_TIMER *timer = al_create_timer(1.0 / 60.0); 40 ALLEGRO_DISPLAY *display = al_create_display(800, 600); 41 ALLEGRO_EVENT_QUEUE *event_queue = al_create_event_queue(); 42 43 ALLEGRO_EVENT event; 44 45 al_register_event_source(event_queue, al_get_keyboard_event_source()); 46 al_register_event_source(event_queue, al_get_timer_event_source(timer)); 47 al_register_event_source(event_queue, al_get_display_event_source(display)); 48 49 al_start_timer(timer); 50 51 bool render = true; 52 bool running = true; 53 54 unsigned int r = 0; 55 unsigned int g = 0; 56 unsigned int b = 0; 57 58 unsigned int ticks = 60; 59 60 while (running) { 61 62 al_wait_for_event(event_queue, &event); 63 64 if (event.type == ALLEGRO_EVENT_KEY_DOWN) { 65 66 if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { 67 68 // End the game. 69 running = false; 70 } 71 } 72 else if (event.type == ALLEGRO_EVENT_TIMER) { 73 74 render = true; 75 76 ++ticks; 77 78 if (ticks >= 30) { 79 80 // Generate new color twice per second. 81 82 r = rand() % 255; 83 g = rand() % 255; 84 b = rand() % 255; 85 86 ticks = 0; 87 } 88 } 89 90 if (render && al_is_event_queue_empty(event_queue)) { 91 92 render = false; 93 94 // Clear to red. 95 al_clear_to_color(al_map_rgb(255, 0, 0)); 96 97 al_draw_filled_rectangle(80, 80, 160, 160, al_map_rgb(r, g, b)); 98 99 al_flip_display(); 100 } 101 } 102 103 al_destroy_timer(timer); 104 al_destroy_display(display); 105 al_destroy_event_queue(event_queue); 106 107 return 0; 108}

Here is the command I use to compile it (not statically):

g++ -Wall -o example example.cpp $(pkg-config --libs allegro-5 allegro_image-5 allegro_primitives-5)

du -h example returns 16K as the file size. Now when I try to compile it with static libraries:

g++ -Wall -o example example.cpp $(pkg-config --libs --static allegro-5 allegro_image-5 allegro_primitives-5)

And du -h example still returns 16K as the file size! :o Shouldn't the file size be considerably larger when statically compiled? Because the file size doesn't change, this leads me to believe that something isn't right. Is there something I'm supposed to do when making Allegro to make sure I can link it statically? ???

Thanks in advance!

Elias
Member #358
May 2000

The static libraries are all named *-static-5, so try for example:

$(pkg-config --libs --static allegro-static-5 allegro_image-static-5 allegro_primitives-static-5)

--
"Either help out or stop whining" - Evert

Eric Johnson
Member #14,841
January 2013
avatar

Elias said:

The static libraries are all named *-static-5

Wow, I feel like an idiot... :o Sure enough, that did the trick. Thanks, Elias! :)

Elias
Member #358
May 2000

Well, ideally we could tell pkg-config to either not require the --static when you use a static library, or automatically pick the -static version when you use --static. However it seems there is no way around requiring both (and if you forget one or the other things fail in non-obvious ways).

--
"Either help out or stop whining" - Evert

Eric Johnson
Member #14,841
January 2013
avatar

That would be nice, but the way it currently works will suffice.

Edgar Reynaldo
Member #8,592
May 2007
avatar

Elias
Member #358
May 2000

Someone please tell me, what good is it to use pkg-config when you have to type more to use it, and not less?

I don't know your definition of "more", but...

$ pkg-config --libs --static allegro
-lalleg -lm -lpthread -lrt -lSM -lICE -lX11 -lXext -lXcursor -lXpm -lXxf86vm -ldl

--
"Either help out or stop whining" - Evert

Edgar Reynaldo
Member #8,592
May 2007
avatar

Elias
Member #358
May 2000

You can use the monolith, yes. But even with the single ones some of them may have extra dependencies which you don't have to remember that way. There is also --cflags in addition to --libs and some addons may require extra flags, for example if you compiled with a dependency with a non-standard include path. Basically all compiler and linker flags are handled by pkg-config instead of yourself.

--
"Either help out or stop whining" - Evert

Edgar Reynaldo
Member #8,592
May 2007
avatar

Eric Johnson
Member #14,841
January 2013
avatar

Using pkg-config is the only way I know to link Allegro in Linux. How would you do it without pkg-config, and what would be the benefits of doing so (aside from less typing, as you suggested, Edgar)?

Edgar Reynaldo
Member #8,592
May 2007
avatar

Linux is just gcc (most the time) so it's as simple as typing out the commands that pkg-config spits out. Notably, pkg-config fails to output '-static' despite gcc preferring dynamic libraries over static ones, even when you specify a static library.

amarillion
Member #940
January 2001
avatar

I'm going to give this a try as well. Eric, which cmake option did you use to generate the allegro-static libraries in the first place?

edit:
I figure it should be

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWANT_STATIC_RUNTIME=on

--
Martijn van Iersel | My Blog | Sin & Cos | Tegel tilemap editor | TINS 2017

Eric Johnson
Member #14,841
January 2013
avatar

I pretty much followed the standard procedures, but used ccmake to turned shared to off. Here's the gist of it:

Update everything:
sudo apt-get install updates

Install required dependencies:
sudo apt-get install build-essential git cmake cmake-curses-gui xorg-dev libgl1-mesa-dev libglu-dev -y

Install additional/optional dependencies:
sudo apt-get install libpng-dev libcurl4-openssl-dev libfreetype6-dev libjpeg-dev libvorbis-dev libopenal-dev libphysfs-dev libgtk2.0-dev libasound-dev libpulse-dev libflac-dev libdumb1-dev - y

Install documentation dependencies, too, if you plan on building docs:
apt-get install exuberant-ctags dvi2ps dvipdfmx latex2html pandoc

Clone Allegro 5:
git clone https://github.com/liballeg/allegro5 && cd allegro5

Make a build directory and navigate to it:
mkdir build && cd build

Use ccmake:
ccmake -DCMAKE_INSTALL_PREFIX=/usr ..

In the above, create and generate, then turned shared to "OFF" (just follow the prompts).

Make and install Allegro:
make && sudo make install && sudo ldconfig

Now everything should be good to go. When compiling, use something like this:

g++ -o example example.cpp $(pkg-config --libs --static allegro-static-5 allegro_image-static-5)

So don't forget the allegro*-static-5 and --static parts.

Doing all of the above resulted in an executable that worked on a fresh installation of Ubuntu 16.04. On that fresh install, I had to install libdumb1 and libopenal1 before running the game though. Maybe those could be statically packaged in as well, but I'm too lazy for that. :P

amarillion
Member #940
January 2001
avatar

So should I use

cmake -DWANT_STATIC_RUNTIME=on

or

cmake -DSHARED=off

or both?

And didn't you also have to compile with a symbol, i.e. something like gcc .... -DALLEGRO_STATICLINK=1

--
Martijn van Iersel | My Blog | Sin & Cos | Tegel tilemap editor | TINS 2017

Eric Johnson
Member #14,841
January 2013
avatar

After running ccmake, I went straight into make. I followed a combination of wiki articles and some general screwing around to get it to work. I used pkg-config, so I didn't do anything special beyond what I already mentioned.

[EDIT]
Here is the official README_pkgconfig.txt, in case you go that route.

amarillion
Member #940
January 2001
avatar

I've tried it using Eric's guidelines, but it seems hardly worth the effort. When I run ldd on the resulting binaries, only the allegro libraries themselves are statically included. But all of allegro's dependencies are still as shared libraries. Meaning that the binary isn't portable to systems that don't have all these dependencies installed. I had expected dependencies such as libogg, libvorbis etc. to be statically linked as well.

Here is the full output of ldd on my krampushack entry:

ldd build/release/game (Without static linking): 88 lines

#SelectExpand
1 linux-vdso.so.1 => (0x00007ffe37342000) 2 liballegro_primitives.so.5.2 => /usr/local/lib/liballegro_primitives.so.5.2 (0x00007f28118e8000) 3 liballegro_dialog.so.5.2 => /usr/local/lib/liballegro_dialog.so.5.2 (0x00007f28116db000) 4 liballegro_image.so.5.2 => /usr/local/lib/liballegro_image.so.5.2 (0x00007f28114ce000) 5 liballegro_acodec.so.5.2 => /usr/local/lib/liballegro_acodec.so.5.2 (0x00007f28112c6000) 6 liballegro_audio.so.5.2 => /usr/local/lib/liballegro_audio.so.5.2 (0x00007f28110b1000) 7 liballegro_ttf.so.5.2 => /usr/local/lib/liballegro_ttf.so.5.2 (0x00007f2810eaa000) 8 liballegro_font.so.5.2 => /usr/local/lib/liballegro_font.so.5.2 (0x00007f2810ca2000) 9 liballegro.so.5.2 => /usr/local/lib/liballegro.so.5.2 (0x00007f28109a5000) 10 libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2810622000) 11 libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2810319000) 12 libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2810103000) 13 libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f280fd39000) 14 libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f280fac8000) 15 libgtk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 (0x00007f280f47d000) 16 libgdk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 (0x00007f280f1c7000) 17 libgdk_pixbuf-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007f280efa5000) 18 libpango-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007f280ed59000) 19 libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f280eb05000) 20 libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f280e7f4000) 21 libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f280e5d7000) 22 libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f280e3b1000) 23 libdumb.so.1 => /usr/lib/x86_64-linux-gnu/libdumb.so.1 (0x00007f280e17d000) 24 libvorbisfile.so.3 => /usr/lib/x86_64-linux-gnu/libvorbisfile.so.3 (0x00007f280df74000) 25 libpulse-simple.so.0 => /usr/lib/x86_64-linux-gnu/libpulse-simple.so.0 (0x00007f280dd6e000) 26 libpulse.so.0 => /usr/lib/x86_64-linux-gnu/libpulse.so.0 (0x00007f280db1e000) 27 libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f280d874000) 28 libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f280d539000) 29 libXcursor.so.1 => /usr/lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007f280d32f000) 30 libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f280d11f000) 31 libXinerama.so.1 => /usr/lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007f280cf1b000) 32 libXrandr.so.2 => /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007f280cd10000) 33 /lib64/ld-linux-x86-64.so.2 (0x0000564254a98000) 34 libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f280cae6000) 35 libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f280c8e3000) 36 libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f280c6e0000) 37 libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f280c4d8000) 38 libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f280c2d5000) 39 libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f280c0a7000) 40 libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f280be94000) 41 libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f280bc91000) 42 libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f280ba8b000) 43 libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f280b888000) 44 libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f280b66f000) 45 libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f280b46a000) 46 libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f280b247000) 47 libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f280b041000) 48 libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f280ae32000) 49 libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f280ac2d000) 50 libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007f280aa29000) 51 libpangocairo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007f280a81b000) 52 libatk-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007f280a5f6000) 53 libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007f280a2e2000) 54 libgio-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007f2809f59000) 55 libpangoft2-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007f2809d43000) 56 libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f2809b00000) 57 libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f28098f5000) 58 libXcomposite.so.1 => /usr/lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007f28096f2000) 59 libthai.so.0 => /usr/lib/x86_64-linux-gnu/libthai.so.0 (0x00007f28094e8000) 60 libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f28092e0000) 61 libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f2809070000) 62 libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f2808e55000) 63 libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007f2808c29000) 64 libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007f2808a20000) 65 libpulsecommon-8.0.so => /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so (0x00007f28087a4000) 66 libjson-c.so.2 => /lib/x86_64-linux-gnu/libjson-c.so.2 (0x00007f2808599000) 67 libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f280834c000) 68 libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f2808148000) 69 libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f2807f42000) 70 libpixman-1.so.0 => /usr/lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007f2807c99000) 71 libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f2807a95000) 72 libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007f280788a000) 73 librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f2807682000) 74 libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f2807460000) 75 libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f2807244000) 76 libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f2806fe6000) 77 libdatrie.so.1 => /usr/lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007f2806ddd000) 78 libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f2806d58000) 79 libwrap.so.0 => /lib/x86_64-linux-gnu/libwrap.so.0 (0x00007f2806b4e000) 80 libsndfile.so.1 => /usr/lib/x86_64-linux-gnu/libsndfile.so.1 (0x00007f28068e4000) 81 libasyncns.so.0 => /usr/lib/x86_64-linux-gnu/libasyncns.so.0 (0x00007f28066de000) 82 libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f28064b8000) 83 liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f2806296000) 84 libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f2805fb5000) 85 libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007f2805d9b000) 86 libFLAC.so.8 => /usr/lib/x86_64-linux-gnu/libFLAC.so.8 (0x00007f2805b26000) 87 libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007f280587d000) 88 libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f2805668000)

ldd build/static/game (83 lines)

#SelectExpand
1 linux-vdso.so.1 => (0x00007ffc681aa000) 2 libgtk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 (0x00007fafd8dab000) 3 libgdk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 (0x00007fafd8af6000) 4 libgdk_pixbuf-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007fafd88d3000) 5 libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fafd8680000) 6 libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fafd836f000) 7 libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007fafd8149000) 8 libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007fafd7ef0000) 9 libFLAC.so.8 => /usr/lib/x86_64-linux-gnu/libFLAC.so.8 (0x00007fafd7c7b000) 10 libdumb.so.1 => /usr/lib/x86_64-linux-gnu/libdumb.so.1 (0x00007fafd7a46000) 11 libvorbisfile.so.3 => /usr/lib/x86_64-linux-gnu/libvorbisfile.so.3 (0x00007fafd783d000) 12 libpulse-simple.so.0 => /usr/lib/x86_64-linux-gnu/libpulse-simple.so.0 (0x00007fafd7638000) 13 libpulse.so.0 => /usr/lib/x86_64-linux-gnu/libpulse.so.0 (0x00007fafd73e7000) 14 libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007fafd70e7000) 15 libopenal.so.1 => /usr/lib/x86_64-linux-gnu/libopenal.so.1 (0x00007fafd6e77000) 16 libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fafd6bcc000) 17 libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fafd69af000) 18 libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fafd6675000) 19 libXcursor.so.1 => /usr/lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007fafd646a000) 20 libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007fafd625a000) 21 libXinerama.so.1 => /usr/lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007fafd6057000) 22 libXrandr.so.2 => /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007fafd5e4b000) 23 libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007fafd5bda000) 24 libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fafd5858000) 25 libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fafd554e000) 26 libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fafd5338000) 27 libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fafd4f6f000) 28 libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007fafd4d6a000) 29 libpangocairo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007fafd4b5d000) 30 libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007fafd4957000) 31 libatk-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007fafd4731000) 32 libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007fafd441d000) 33 libgio-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007fafd4095000) 34 libpangoft2-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007fafd3e7e000) 35 libpango-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007fafd3c32000) 36 libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fafd39ef000) 37 libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007fafd37e4000) 38 libXcomposite.so.1 => /usr/lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007fafd35e1000) 39 libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007fafd33dd000) 40 libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007fafd31cb000) 41 libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fafd2fc2000) 42 libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fafd2d52000) 43 libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fafd2b38000) 44 libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007fafd292e000) 45 libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007fafd2702000) 46 libpulsecommon-8.0.so => /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so (0x00007fafd2486000) 47 libjson-c.so.2 => /lib/x86_64-linux-gnu/libjson-c.so.2 (0x00007fafd227b000) 48 libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fafd202f000) 49 libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fafd1e2a000) 50 librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fafd1c22000) 51 /lib64/ld-linux-x86-64.so.2 (0x00005615623b9000) 52 libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fafd19ff000) 53 libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fafd17d6000) 54 libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007fafd15d2000) 55 libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007fafd13cf000) 56 libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007fafd11c8000) 57 libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007fafd0fc4000) 58 libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007fafd0d96000) 59 libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fafd0b94000) 60 libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007fafd097a000) 61 libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007fafd0775000) 62 libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007fafd056f000) 63 libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007fafd035f000) 64 libpixman-1.so.0 => /usr/lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007fafd00b7000) 65 libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007fafcfeb2000) 66 libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007fafcfca8000) 67 libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fafcfa86000) 68 libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fafcf86a000) 69 libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007fafcf60c000) 70 libthai.so.0 => /usr/lib/x86_64-linux-gnu/libthai.so.0 (0x00007fafcf403000) 71 libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fafcf37d000) 72 libwrap.so.0 => /lib/x86_64-linux-gnu/libwrap.so.0 (0x00007fafcf173000) 73 libsndfile.so.1 => /usr/lib/x86_64-linux-gnu/libsndfile.so.1 (0x00007fafcef09000) 74 libasyncns.so.0 => /usr/lib/x86_64-linux-gnu/libasyncns.so.0 (0x00007fafced03000) 75 libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fafceafe000) 76 libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fafce8f8000) 77 libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007fafce6d2000) 78 libdatrie.so.1 => /usr/lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007fafce4ca000) 79 liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fafce2a8000) 80 libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fafcdfc6000) 81 libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fafcddad000) 82 libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007fafcdb04000) 83 libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fafcd8ef000)

edit: I can get it to include ldumb the following way.
Starting from the line

$(pkg-config --libs --static $(ALLEGRO_LIBS))

which for me expands to:

-L/usr/local/lib -lallegro_primitives-static -lallegro_main-static -lallegro_dialog-static -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lgthread-2.0 -lglib-2.0 -lallegro_image-static -lpng -lz -ljpeg -lallegro_acodec-static -lFLAC -logg -ldumb -lvorbisfile -lvorbis -logg -lallegro_audio-static -lpulse-simple -lpulse -lasound -lopenal -lallegro_ttf-static -lfreetype -lz -lallegro_font-static -lallegro-static -lm -lpthread -lSM -lICE -lX11 -lXext -lXcursor -lXi -lXinerama -lXrandr -lGLU -lGL

I changed that around like so:

-L/usr/local/lib -Wl,-Bstatic -lallegro_primitives-static -lallegro_main-static -lallegro_dialog-static -lallegro_image-static -lallegro_audio-static -lallegro_ttf-static -lallegro_font-static -lallegro_acodec-static -lallegro-static -ldumb -Wl,-Bdynamic -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lgthread-2.0 -lglib-2.0 -lpng -lz -ljpeg -logg -lFLAC -lvorbisfile -lvorbis -lpulse-simple -lpulse -lasound -lopenal -lfreetype -lz -lm -lpthread -lSM -lICE -lX11 -lXext -lXcursor -lXi -lXinerama -lXrandr -lGLU -lGL

Now libdumb is also statically linked. Downside is that you can no longer use pkg-config, you have to manually run it and add the result to your makefile.

--
Martijn van Iersel | My Blog | Sin & Cos | Tegel tilemap editor | TINS 2017

Elias
Member #358
May 2000

WANT_STATIC_RUNTIME does nothing in Linux I think, but in Windows it allows you to also link libc itself statically (I don't think that would make sense in Linux due to the kernel dependencies of libc).

One easy way to static link dumb is to rename the static library (libdumb_s.a instead of libdumb.a for example), then in cmake (I use cmake-gui) change the dumb library to libdumb_s.a. This way when cmake outputs -ldumb_s it is forced to static link it.

--
"Either help out or stop whining" - Evert

Edgar Reynaldo
Member #8,592
May 2007
avatar

Go to: