delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2016/05/17/04:30:15

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "neozeed (neozeed AT superglobalmegacorp DOT com) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Trying to link Allegro, but something is wrong. Any pointers appreciated
Date: Tue, 17 May 2016 16:16:36 +0800
Organization: Qemu OS/2
Lines: 97
Message-ID: <20160517-081636.48.0@neozeed.news.eternal-september.org>
References: <e5a345c1-cfcb-4951-bc97-ae41166756ce AT googlegroups DOT com>
Mime-Version: 1.0
Injection-Info: mx02.eternal-september.org; posting-host="2c1403dac57d9864a2959231725937f8";
logging-data="18529"; mail-complaints-to="abuse AT eternal-september DOT org"; posting-account="U2FsdGVkX1+6I8NE2urw80XhKKsXaob5"
X-Newsreader: WinVN 0.99.16.0 (x86 64bit)
Cancel-Lock: sha1:7UjeTLbQLxlW+qU6UGzl4RQnoSw=
Bytes: 5363
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <e5a345c1-cfcb-4951-bc97-ae41166756ce AT googlegroups DOT com>, 
mike AT letsdeliver DOT com says...
>Hi there! A while back I started working on a small personal project, to 
make a short MS-DOS game, but I'm kind of stumped and could use some 
pointers from someone experienced.
>
>My main OS is Mac OS X, so I've followed instructions I found online to get 
DJGPP working (and cross compiling for DOS) on OSX. Which works perfectly, I 
can generate .EXE files that run on the real thing, from the comfort of my 
work computer.
>
>So now I'm trying to get Allegro, a game library, to work. I modified the 
Makefile of an older version (4.2.2, one that still targeted DOS), and 
managed to get it to compile the liballeg.a library without errors.
>
>From there, the plan was to make a short "hello world" example using 
Allegro's functionality. Unfortunately, the linking step is failing.
>
>My repo with all my files (including my copy of Allegro) is here: 
https://github.com/msikma/allegro-dos-test
>
>Basically, when I run make, it seems to be linking Allegro twice. I get 
about 18 thousand error messages complaining about multiple definitions. 
This has me completely stumped. My makefile is here: 
https://github.com/msikma/aliballeg.a file.
>
>Here's a log of make: 
https://gist.githubusercontent.com/msikma/cb28624117475e24d0e6e0594775ae73/r
aw/ea76fd4689375fd6169ad6c79f72ed13ce03145b/compile.txt
>
>And the C file I'm trying to compile: https://github.com/msikma/allegro-
dos-test/blob/be760a4f6cf1a41755813d5d55e15620cf16a12f/src/main.c
>
>Any help that you could give is greatly appreciated :)
>Michiel Sikma


While it's not version 4.x I've been using version 2 & 3 along with GCC 4 & 
5 on DJGPP.  Although I first of all built Allegro using GCC 2.7 inside of 
DOSBox.  Lots of the assembly is now invalid, making it a lot of work with 
these older versions so I didn't try to fight it.  For the heck of it, I 
rebuilt Allegro 3.12 using GCC 5.10 (I'm on Windows but I really don't think 
it matters).  I just ran what would compile on Windows, than ran the parts 
that have issues with either needing native exe's, or just old ASM syntax:

so run make, and it'll fail.  Then I rean this under DOSBox, using gcc 
2.7.2.1

obj\djgpp\asmdef obj\djgpp\asmdef.inc
gcc -x assembler-with-cpp -I. -Isrc -Iobj/djgpp -Wall -Wno-unused -o 
obj/djgpp/blit8.o -c src/blit8.s
gcc -x assembler-with-cpp -I. -Isrc -Iobj/djgpp -Wall -Wno-unused -o 
obj/djgpp/blit16.o -c src/blit16.s
gcc -x assembler-with-cpp -I. -Isrc -Iobj/djgpp -Wall -Wno-unused -o 
obj/djgpp/blit32.o -c src/blit32.s
gcc -I. -Isrc -Iobj\djgpp -Wall -Wno-unused -O2 -ffast-math -fomit-frame-
pointer  -o obj\djgpp\cpu.o -c src\cpu.c
gcc -I. -Isrc -Iobj/djgpp -Wall -Wno-unused -O2 -ffast-math -fomit-frame-
pointer  -o obj/djgpp/fli.o -c src/fli.c
gcc -I. -Isrc -Iobj/djgpp -Wall -Wno-unused -O2 -ffast-math -fomit-frame-
pointer  -o obj/djgpp/flood.o -c src/flood.c
@REM gcc -I. -Isrc -Iobj/djgpp -Wall -Wno-unused -O2 -ffast-math -fomit-
frame-pointer  -o obj/djgpp/poly3d.o -c src/poly3d.c
gcc -x assembler-with-cpp -I. -Isrc -Iobj/djgpp -Wall -Wno-unused -o 
obj/djgpp/scanline.o -c src/scanline.s
ren OBJ\DJGPP\SCANLINE.O scanline.o
gcc -x assembler-with-cpp -I. -Isrc -Iobj/djgpp -Wall -Wno-unused -o 
obj/djgpp/xgfx.o -c src/xgfx.s
gcc -x assembler-with-cpp -I. -Isrc -Iobj/djgpp -Wall -Wno-unused -o 
obj/djgpp/bank.o -c src/djgpp/bank.s
gcc -I. -Isrc -Iobj/djgpp -Wall -Wno-unused -O2 -ffast-math -fomit-frame-
pointer  -o obj/djgpp/sw.o -c src/djgpp/sw.c

it did leave two unresolved symbols, which I just added in vbeaf.c:


int int_ds;
int saved_ds;

and I re-compiled that, and it seems to be working OK.

Then I ran make again on Windows with GCC 5.10 and got a working library.  I 
just compiled MAME 0035, on both MS-DOS and the Windows version, and the 
System16 emulaion (what I'm interested in) is bug perfect on both versions.  
And the sound works (in DOSBox).

Don't mix DJGPP runtimes, otherwise when you exit you'll get the following 
errors:

combinelo: memory fouled
free: memory fouled

and it'll crash.

Basically use DOSBox, and build Allegro if you must, or build the parts that 
modern GCC/binutils will choke on.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019