Linux to DOS/Windows Cross Compiler

Warning: This is from 2010 or earlier. That’s extremely old! It is quite likely out of date or incorrect.

How to make a Linux to DOS/Windows Cross Compiler

I wanted to be able to compile stuff on my K6-3 Redhat Linux box that would run on my P2 Windows box. The lack of information I found on doing this made me want to write this.

“Target” means the computer that you will be compiling programs for. In my case, the target was my Windows computer, “i686-pc-dosdjgpp.”

Some sites I found helpful:

The steps:

  1. You’ll need to have some sources. You’ll need binutils and gcc. In my opinion the best way to get these is to download them from ftp.gnu.org. You’ll also need some libraries and header files that are compiled for the target platform. I downloaded a file from DJGPP called djcrx. I guess that’s kind of an abbreveation for “cross.” You can go to the DJGPP web site at www.delorie.com, but it’s a crowded place, so you might want to go straight to ftp.simtel.net/pub/simtelnet/gnu/djgpp/, and then praise DJ Delorie every chance you get.
  2. First uncompress binutils. “bunzip binutils-bleh.tar.bz2”
  3. Untar binutils. “tar xvf binutils-bleh.tar”
  4. Go into the binutils directory. “cd binutils-bleh/”
  5. Configure binutils with the correct target. “./configure –target=i686-pc-msdosdjgpp”
  6. Make binutils. “make”
  7. Install binutils. The files will be placed in “/usr/local/target.” For me this directory was “/usr/local/i686-pc-dosdjgpp.” “make install”