delorie.com is funded by banner ads.
  www.delorie.com/djgpp/v2faq/faq179.html   search  

| Previous | Next | Up | Top |

22.8 DJGPP as cross-compiler

Q: I want to use DJGPP as a cross-compiler for Motorola 68K targets. How should I proceed about this?

Q: I want to build GCC as a Unix-to-DOS cross-compiler. What should I do?


A: If you want a cross-compiler for m68k on a DOS machine, you need DJGPP configured as host=i386-go32, and target=m68k-coff. Such a package is already available. The binaries there are based on GCC 2.7.2. This package is reportedly no longer supported, but if you have questions about it, you can send them to Jim Karpinski. You can also try to contact Kai Ruottu, who is the provider of DOS-hosed gcc-m68k. Note that this package has only basic support for C++: the compiler is included, but the libraries, including libstc++ and libg++, and the C++ headers are missing, so even cin and cout don't work.

A Win32-hosted gcc-m68k is another possibility. It was created by David Fiddes. The Cygwin32 port of GCC can also be configured as a cross-compiler with m68k as the target. See the description of the Cygnus project, for more details about the Cygwin32 port.

DJGPP can be built and installed as a cross-compiler running on a Unix machine and targeting DOS/Windows platforms. Here are the necessary steps to do that:

  1. Download the cross-compiler toolkit v2/djcrx201.zip from the usual DJGPP sites.

  2. Unpack djcrx201.zip on the Unix machine using unzip -a.

    You must use the -a switch, to force unzip to convert any DOS-style text file with CR-LF pairs at the end of each line to Unix-style text files. If you don't, things will break for you.

    unzip is available in source form from many FTP sites.

  3. Link or move the files in the cross directory to the top-level directory, where you unzipped djcrxNNN.zip.

  4. Download the latest GCC and Binutils distributions from your favorite GNU FTP site.

    The main GNU site is at ftp.gnu.org.

  5. Unpack GCC and Binutils from the same directory where you unzipped djcrxNNN.zip.

  6. You might need to edit the Makefile, either to choose an installation directory as appropriate for your machine, or to change the names of the directories where the GCC and Binutils distributions are unpacked (e.g., because their version numbers are different from what the Makefile says).

  7. Follow instructions in the file cross/install that was unpacked from djcrx201.zip to build and install the cross compiler.
The cross-compiler you build is installed as dos-gcc, so to compile programs with it, use dos-gcc rather than cc or gcc, or set CC=dos-gcc when invoking Make.

The file cross/readme has some usage info for dos-gcc. It is generally correct, except that the version numbers for the various packages might not be up to date. You should always use the latest releases of every package.

Another alternative is the RPM (Redhat Package Maintenance) distribution of the Linux to DOS cross-compiler, which is based on DJGPP v2.01 and includes everything you need to create DJGPP binaries on Linux (without running DOSEmu). This package has been built by James Soutter using the instructions above; you will need Linux and RPM 2.2.7. The RPM packaged cross-compiler is available from Redhat site; the sources are also available.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright ⌐ 1998   by Eli Zaretskii     Updated Sep 1998  

Powered by Apache!

You can help support this site by visiting the advertisers that sponsor it! (only once each, though)