Runing Allegro binary on different pc.

Hi, I have written a snake game using allegro. So I want to share it with my friends, but the binary file won't execute, even after installing allegro. They have to compile the game from source. Is there a way to pack the game binary with the runtime files like in windows?
It is a hell to do it in *nix, but certainly possible, if you pack all depedencies or compile it statically.
OK, so I did:
g++ game.cpp -o static -static `allegro-config --static --libs release`
And got a lot of errors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/usr/lib/liballeg.a(umodules.o): In function `_unix_load_modules':
(.text+0x2f3): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/liballeg.a(file.o): In function `canonicalize_filename':
(.text+0x490e): warning: Using 'getpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/liballeg.a(file.o): In function `canonicalize_filename':
(.text+0x4909): warning: Using 'setpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/liballeg.a(file.o): In function `canonicalize_filename':
(.text+0x494b): warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libX11.a(GetDflt.o): In function `GetHomeDir':
(.text+0xa7): warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libX11.a(GetDflt.o): In function `GetHomeDir':
(.text+0x102): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libX11.a(xim_trans.o): In function `_XimXTransSocketUNIXConnect':
(.text+0xe23): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libXcursor.a(cursor.o): In function `XcursorImageLoadCursor':
(.text+0x9df): undefined reference to `XRenderFindStandardFormat'
/usr/lib/libXcursor.a(cursor.o): In function `XcursorImageLoadCursor':
(.text+0xa02): undefined reference to `XRenderCreatePicture'
/usr/lib/libXcursor.a(cursor.o): In function `XcursorImageLoadCursor':
(.text+0xa2d): undefined reference to `XRenderCreateCursor'
/usr/lib/libXcursor.a(cursor.o): In function `XcursorImageLoadCursor':
(.text+0xa3b): undefined reference to `XRenderFreePicture'
/usr/lib/libXcursor.a(cursor.o): In function `XcursorImagesLoadCursor':
(.text+0x178d): undefined reference to `XFixesSetCursorName'
/usr/lib/libXcursor.a(cursor.o): In function `XcursorImagesLoadCursor':
(.text+0x1804): undefined reference to `XRenderCreateAnimCursor'
/usr/lib/libXcursor.a(display.o): In function `_XcursorGetDisplayInfo':
(.text+0x254): undefined reference to `XRenderQueryExtension'
/usr/lib/libXcursor.a(display.o): In function `_XcursorGetDisplayInfo':
(.text+0x518): undefined reference to `XRenderQueryVersion'
/usr/lib/libX11.a(ClDisplay.o): In function `XCloseDisplay':
(.text+0xbd): undefined reference to `xcb_disconnect'
/usr/lib/libX11.a(OpenDis.o): In function `OutOfMemory':
(.text+0x449): undefined reference to `xcb_disconnect'
/usr/lib/libX11.a(OpenDis.o): In function `XOpenDisplay':
(.text+0x7f4): undefined reference to `xcb_get_setup'
/usr/lib/libX11.a(OpenDis.o): In function `XOpenDisplay':
(.text+0xd6d): undefined reference to `xcb_get_maximum_request_length'
/usr/lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0xa8): undefined reference to `xcb_parse_display'
/usr/lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x16e): undefined reference to `xcb_connect_to_display_with_auth_info'
/usr/lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x18c): undefined reference to `xcb_get_file_descriptor'
/usr/lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x1b3): undefined reference to `xcb_generate_id'
/usr/lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x1f0): undefined reference to `xcb_connection_has_error'
/usr/lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x224): undefined reference to `xcb_connect'
/usr/lib/libX11.a(xcb_io.o): In function `require_socket':
(.text+0x3b4): undefined reference to `xcb_take_socket'
/usr/lib/libX11.a(xcb_io.o): In function `wait_or_poll_for_event':
(.text+0x43c): undefined reference to `xcb_wait_for_event'
/usr/lib/libX11.a(xcb_io.o): In function `wait_or_poll_for_event':
(.text+0x4a5): undefined reference to `xcb_poll_for_event'
/usr/lib/libX11.a(xcb_io.o): In function `process_responses':
(.text+0x56b): undefined reference to `xcb_poll_for_reply'
/usr/lib/libX11.a(xcb_io.o): In function `process_responses':
(.text+0x6ea): undefined reference to `xcb_connection_has_error'
/usr/lib/libX11.a(xcb_io.o): In function `_XAllocIDs':
(.text+0x7dc): undefined reference to `xcb_generate_id'
/usr/lib/libX11.a(xcb_io.o): In function `_XIDHandler':
(.text+0x84e): undefined reference to `xcb_generate_id'
/usr/lib/libX11.a(xcb_io.o): In function `_XSend':
(.text+0xa41): undefined reference to `xcb_writev'
/usr/lib/libX11.a(xcb_io.o): In function `_XReply':
(.text+0xc2a): undefined reference to `xcb_wait_for_reply'
collect2: ld returned 1 exit status 

Am I missing something?
Solved it, it's very easy actually. Here is how:
g++ game.cpp -o game `allegro-config --static`

It increases the file size with about 800KB, but works :)
Last edited on
Topic archived. No new replies allowed.