delorie.com/djgpp/faq/v2/cross-linux.html   search  
Cross compiling from Linux


Date: Wed, 3 May 95 23:34 MDT
From: mat@ardi.com (Mat Hostetter)
To: ddt@gibs.idsoftware.com
Subject: Re: hi
In-Reply-To: <199505031435.JAA00847@gibs.idsoftware.com>
References: <199505031435.JAA00847@gibs.idsoftware.com>
cc: djgpp-v2

>>>>> "ddt" == ddt  <ddt@gibs.idsoftware.com> writes:

    ddt> Could you tell me how you went about getting djgpp to run
    ddt> under linux?  We had someone do it for us for nextstep, but
    ddt> it's an old version, and i'd like to be able to do it for
    ddt> future versions.  Has it been rewritten in v2 to compile
    ddt> cleanly under linux?

[I've cc'd this to the djgpp-v2 list in case they have any advice].

You cannot build the v2 libc easily under Linux because of Makefile
problems.  Fortunately, you don't need to, since the distribution
comes with libc.  Whenever I've needed to fix some particular file in
v2 libc I've just compiled it by hand and inserted it into libc.a with
ar.

To set up your Linux system to compile v2 apps, you need to:

  1) Build and install a cross-compiling gcc and binutils.  I think I
     configured them --host=i486-linux --target=i386-msdos-go32.
  2) Create /usr/local/i386-msdos-go32/{include,lib}.
  3) Transfer the appropriate files from v2 into these directories.
  4) Convert the DOS CR/LF pairs to UNIX-style textfiles for everything
     in the include/ tree, as well as for lib/djgpp.lnk
  5) Change lib/djgpp.lnk's OUTPUT_FORMAT to "coff-i386".  Some strange
     config problems seem to prevent binutils from cross-generating
     coff-go32.  It doesn't seem to matter which you use, although
     I had to add a couple of "-Xlinker" lines to our Makefile to
     handle some underscore problems.

I've heard that if you have your linux gcc and binutils set up
properly, you can just use those as cross-tools with scripts to set up
appropriate environment variables before invoking them.  Not too
surprising, since both use i386-coff (although Linux is moving to
ELF).

As I mentioned before, we use this setup in a production environment
for a shipping commercial app, and it works well.

-Mat


  webmaster     delorie software   privacy  
  Copyright © 1995     Updated Jun 1995