Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Trying to make a DOS game for fun, but setting it up is tricky

This thread is locked; no one can reply to it. rss feed Print
Trying to make a DOS game for fun, but setting it up is tricky
dada__
Member #16,089
September 2015
avatar

So I've got a bit of a weird/niche situation here. I'm hoping for some feedback on what to do.

I've always been a fan of DOS games, so I've always wanted to make one. A small one. So I've been trying to set up a dev environment that will work for me.

But since I'm also a spoiled new age developer I'm trying to make it so that I can cross compile for DOS on my Mac OS X machine. And I can, using DJGPP compiled for OSX! I can make a hello world just fine, it produces a .EXE and it runs perfectly on the real thing.

So now I've moved on to trying to get Allegro to work. I'm using Allegro 4.2.2 for compatibility. My test repo is here.

My initial idea was to run fix.sh djgpp and then simply #include Allegro to see if I could compile it normally as a dependency. Unfortunately that doesn't work since it eventually reaches msvchelp.c which requires Windows, although all files before that compile just fine.

My question, am I just totally doing it wrong by including allegro.h and expecting it to be compilable? Do I need to take a whole different approach? Perhaps there's a pre-compiled Allegro for DOS that I can include instead of the sources?

Any help you can give me is greatly appreciated :)

Bruce Perry
Member #270
April 2000

I assume msvchelp.c is in a Windows-specific directory, and you can find a way to exclude it (along with other platform-specific directories that aren't DOS)?

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

dada__
Member #16,089
September 2015
avatar

You're right, my problem was that I was trying to compile Allegro using my own Makefile, basically by simply finding and compiling all .c files. Which was kind of stupid to begin with I guess. It works for small libs but Allegro is too complex.

So right now I'm trying to get the xmake.sh script working, by setting the variables to my DJGPP install... I feel like this is a better way forward.

Chris Katko
Member #1,881
January 2002
avatar

I think it would be much easier to run DJGPP in DosBox. All the libraries will work as intended.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

dada__
Member #16,089
September 2015
avatar

I've managed to get quite far. With some small modifications, I can compile Allegro 4.2.2 for DOS on OSX. I think back when this was made, no one considered DJGPP for cross compilation (the MinGW makefile has support for it though).

Still have some problems to work out. For example, it errors out when it tries to compile setup.exe, but I think I don't really need the utilities if I have the library. So just running make lib finishes without errors now.

I think I'll be able to make it work for my purposes with a bit more time. :)

edit:

Seems I've run into a problem. So I managed to compile the library, by running xmake.sh lib, which works fine. It generates liballeg.a without errors.

Unfortunately, when I then try to actually use the library, it gives me a huge amount of "multiple definition" errors. It's like it's being linked twice, but I can't figure out why.

Here's a log of make: https://gist.githubusercontent.com/msikma/cb28624117475e24d0e6e0594775ae73/raw/ea76fd4689375fd6169ad6c79f72ed13ce03145b/compile.txt

My makefile: https://github.com/msikma/allegro-dos-test/blob/be760a4f6cf1a41755813d5d55e15620cf16a12f/Makefile

I can't see what's wrong at all. This really has me stumped. Anyone have a clue of what's going on? ???

edit:

After some great help on the DJGPP mailing list, plus some more hacking, I was able to compile Allegro and get the "hello world" program working. I'm gonna do a write-up for whoever also happens to be interested in DOS games (probably not many people) on the repository I've set up for this.

bamccaig
Member #7,536
July 2006
avatar

I barely noticed this thread, but it reminds me that I recently rediscovered and tried out DosBox for the first time and got a flavor for the same thing. I quit when things started to fail and somebody in IRC told me that DosBox doesn't support DJGPP, but it's quite intriguing for sure. I'm impressed that you've persevered so far. Good for you! I'm a little bit surprised that you are stuck trying to build Allegro for DOS though. I would have expected executables to be available... In any case, definitely make any changes you'd made available in patch form for anybody else that tries! Maybe an existing developer will even be able to pull that into the 4.x branch. Thanks and good job for all that you've accomplished so far!

Go to: