Skip to content

Instantly share code, notes, and snippets.

@msikma
Last active May 16, 2016 10:21
Show Gist options
  • Save msikma/2cb0e50fa49f8011311b21740f1f22ba to your computer and use it in GitHub Desktop.
Save msikma/2cb0e50fa49f8011311b21740f1f22ba to your computer and use it in GitHub Desktop.
I'm trying to compile Allegro for making a DOS game. My compiler is DJGPP, compiled for Mac OS X, which works for generating .exe files that run on DOS.
First, the compilation of the library:
./xmake.sh lib
i586-pc-msdosdjgpp-gcc -DALLEGRO_SRC -DALLEGRO_LIB_BUILD -Wall -Wno-unused -mtune=i586 -O2 -funroll-loops -ffast-math -fomit-frame-pointer -I. -I./include -o obj/djgpp/alleg/allegro.o -c src/allegro.c
i586-pc-msdosdjgpp-gcc -DALLEGRO_SRC -DALLEGRO_LIB_BUILD -Wall -Wno-unused -mtune=i586 -O2 -funroll-loops -ffast-math -fomit-frame-pointer -I. -I./include -o obj/djgpp/alleg/blit.o -c src/blit.c
i586-pc-msdosdjgpp-gcc -DALLEGRO_SRC -DALLEGRO_LIB_BUILD -Wall -Wno-unused -mtune=i586 -O2 -funroll-loops -ffast-math -fomit-frame-pointer -I. -I./include -o obj/djgpp/alleg/bmp.o -c src/bmp.c
...
i586-pc-msdosdjgpp-ar rs lib/djgpp/liballeg.a obj/djgpp/alleg/allegro.o obj/djgpp/alleg/blit.o [...] obj/djgpp/alleg/djirq.o obj/djgpp/alleg/djirqs.o
i586-pc-msdosdjgpp-ar: creating lib/djgpp/liballeg.a
This generates lib/djgpp/liballeg.a.
In my Makefile, I specify the location of the file:
LDFLAGS = -Lvendor/allegro-4.2.2-djgpp-xc/lib/djgpp -lalleg
When compiling a simple main.c file containing a standard Allegro example, which includes <allegro.h>, the following happens:
/usr/local/djgpp/bin/i586-pc-msdosdjgpp-gcc -o dist/main.exe src/main.o -Lvendor/allegro-4.2.2-djgpp-xc/lib/djgpp -lalleg
vendor/allegro-4.2.2-djgpp-xc/lib/djgpp/liballeg.a(allegro.o):allegro.c:(.text+0x30): multiple definition of `set_window_title'
src/main.o:main.c:(.text+0x1e): first defined here
vendor/allegro-4.2.2-djgpp-xc/lib/djgpp/liballeg.a(allegro.o):allegro.c:(.text+0x50): multiple definition of `desktop_color_depth'
src/main.o:main.c:(.text+0x46): first defined here
vendor/allegro-4.2.2-djgpp-xc/lib/djgpp/liballeg.a(allegro.o):allegro.c:(.text+0x70): multiple definition of `get_desktop_resolution'
src/main.o:main.c:(.text+0x6b): first defined here
vendor/allegro-4.2.2-djgpp-xc/lib/djgpp/liballeg.a(allegro.o):allegro.c:(.text+0x90): multiple definition of `_default_ds'
src/main.o:main.c:(.text+0x9c): first defined here
vendor/allegro-4.2.2-djgpp-xc/lib/djgpp/liballeg.a(allegro.o):allegro.c:(.text+0xa0): multiple definition of `bmp_write_line'
src/main.o:main.c:(.text+0xaf): first defined here
vendor/allegro-4.2.2-djgpp-xc/lib/djgpp/liballeg.a(allegro.o):allegro.c:(.text+0xb0): multiple definition of `bmp_read_line'
src/main.o:main.c:(.text+0xcb): first defined here
vendor/allegro-4.2.2-djgpp-xc/lib/djgpp/liballeg.a(allegro.o):allegro.c:(.text+0xc0): multiple definition of `bmp_unwrite_line'
src/main.o:main.c:(.text+0xe7): first defined here
[ removed about 18 thousand lines ]
vendor/allegro-4.2.2-djgpp-xc/lib/djgpp/liballeg.a(grip.o):grip.c:(.text+0x1720): multiple definition of `yield_timeslice'
src/main.o:main.c:(.text+0x1a53): first defined here
vendor/allegro-4.2.2-djgpp-xc/lib/djgpp/liballeg.a(grip.o):grip.c:(.text+0x1740): multiple definition of `_set_color'
src/main.o:main.c:(.text+0x1a72): first defined here
/usr/local/djgpp/lib/gcc/i586-pc-msdosdjgpp/5.2.0/../../../../i586-pc-msdosdjgpp/bin/ld: src/main.o: bad reloc address 0x20 in section `.eh_frame'
collect2: error: ld returned 1 exit status
make: *** [dist/main.exe] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment