delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/23/02:38:14

Sender: tim AT mxrelay DOT g-net DOT be
Message-ID: <3B84A4AF.70433B44@falconsoft.be>
Date: Thu, 23 Aug 2001 08:37:35 +0200
From: Tim Van Holder <tim DOT vanholder AT falconsoft DOT be>
Organization: Anubex N.V.
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.16-3 i686)
X-Accept-Language: en, nl-BE, nl
MIME-Version: 1.0
To: Will Robinson <wsr23 AT stanford DOT edu>, djgpp AT delorie DOT com
Subject: Re: linux->dos cross-compiler
References: <8934b01a DOT 0108221952 DOT 3032c4e6 AT posting DOT google DOT com>
Reply-To: djgpp AT delorie DOT com

"Yeah, it's definitely possible; I did it a month ago..."  :-)

But seriously, all you need to do is:

 - get a binutils tarball (2.11.2 is the latest I think)
 - get a gcc tarball (might as well use 3.0)
   [both the above are at ftp.gnu.org/gnu/; you can use CVS versions
    as well, of course]
 - get djcrx203.zip
 - choose where to put the cross-compiler (ie: what prefix)
   [these guidelines assume /opt/djgpp, but you can just put it in /usr
    with the rest of the system]
 - mkdir /opt/djgpp; cd /opt/djgpp
   [Note: for optimal safety, make /opt/djgpp user-owned; that way, you
    can do 'make install' as a regular user during this build process
    and avoid overwriting files due to typos]
 - mkdir i586-pc-msdosdjgpp
 - unzip djcrx203.zip in /opt/djgpp/i586-pc-msdosdjgpp
 - extract the binutils tarball somewhere
 - cd <binutils-source-dir>
 - mkdir djbuild; cd djbuild
 - ../configure --prefix=/opt/djgpp --target=i586-pc-msdosdjgpp
   [use whatever flags/options you like, but the --target and --prefix
    must be there]
 - make
 - make install
   [You can now remove the binutils tree to save space if you like]
 - extract the gcc tarball somewhere
 - cd <gcc-source-dir>
 - mkdir djbuild; cd djbuild
 - ../configure --prefix=/opt/djgpp --target=i586-pc-msdosdjgpp
   [Note: you _might_ need to add /opt/djgpp/i586-pc-msdosdjgpp/bin to
    PATH for this to work properly]
 - make bootstrap
   [This builds the compiler 2 or three times to verify it's functional]
 - make
   [This _should_ build ebverything else (C++ library, ...)]
 - make install
 - all done!

In order to use the stuff you built, you'll need to adjust a few envvars
so /opt/djgpp is used.  I have the following in my .bashrc:

if (echo $PATH | grep /opt/djgpp 2>/dev/null >/dev/null); then
  : already set up
else
  export PATH=/opt/djgpp/bin:$PATH:$HOME/bin
  export LD_LIBRARY_PATH=/opt/djgpp/lib:$LD_LIBRARY_PATH
  export MANPATH=/opt/djgpp/man:$MANPATH
  export INFOPATH=/opt/djgpp/info:/usr/info:/usr/local/info
fi

Hope this helps. Note: no guarantees; as far as I remember, this is what
I did when I built my cross-to-djgpp compiler on RedHat 6.2 (I used
binutils 2.11 and a cvs version of gcc 3.0.1 in case it matters).

- Raw text -


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