www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/13/21:18:33

Xref: news2.mv.net comp.os.msdos.djgpp:2671
From: ken AT calast DOT com (Ken Greenberg)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to build a dos to mips cross compiler???
Date: Fri, 12 Apr 1996 09:31:56 -0400
Organization: California Advanced Software Tools, Inc.
Lines: 58
Message-ID: <Mtlbx4J1BwBc088yn@calast.com>
References: <4kk110$r12 AT what DOT why DOT net> <4kl8pk$11l7 AT rs18 DOT hrz DOT th-darmstadt DOT de>
Reply-To: ken AT calast DOT com
NNTP-Posting-Host: waltz.rahul.net
NNTP-Posting-User: ken
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <4kl8pk$11l7 AT rs18 DOT hrz DOT th-darmstadt DOT de>,
>First of all, you have to get the complete source for gcc from the FSF, since
>only the necessary file for Intel CPUs are included in the djgpp source of
>gcc (I think).

No. The GCC sources distributed with DJGPP include everything you need to
build a MIPS cross compiler running under DOS. Been there, done that.


> On unix you have a script called configure which will
>create the necessary links to host machine and target description files, you
>probably have to do the same things that the script does (and of course copy
>the files since there is no symlink in DOS). Then the compiler should
>build, however, since there are probably loads of sh dependencies in
>the Makefiles, these may need tweaking also. Probably much easier to first
>build a unix->dos cross compiler and then use that to build the DOS->something
>compiler.

True, but I did it a different way. The problem is that you need to 
run the configure scripts to set up for building the compiler. The configure
scripts (there are lots of them, and they call each other) can only really
be run on a UNIX machine, since DOS has no facility for running shell
scripts. So, step one is to load the GCC sources onto a UNIX machine. The
first problem you will run into (assuming you have a UNIX machine and a way
to upload) is that the filenames have all been truncated to be DOS compatible.
When you run the scripts, you will need to "untruncate" them back to their
original UNIX names, since that's what the scripts expect to see. This is a
pretty much manual process. Perhaps it would be better to get a fresh copy
of the sources to GCC if you think this would be a problem, but make sure
you have the same version number. Only a few files in each directory have
this name truncation property.

There are really two things that configure does. First, it builds Makefiles
that have the proper defines in them for building a cross-MIPS compiler.
Second, it copies the MIPS versions of certain files into the expected
locations. Suppose, for example, that GCC expects to find a file called
"target.h" - you want the MIPS version of the target header to be copied
to target.h. Configure does this for you. You need to identify which files
have been produced in this manner and copy them back down to your PC. As
for the Makefiles, the modified lines are all in one place and are relatively
easy to find.

I found that the easiest thing to do was edit the Makefiles that came with
the DJGPP sources for GCC to just add the lines that were generated by
configure on UNIX. Then, you just run make, and the compiler will build.
Don't forget to do this for binutils, as well. You need the assembler,
linker, utilities, etc.

It is a bit of trouble to go through this, but I was able to build a perfectly
reasonable cross-MIPS compiler this way. I run it under DJGPP and produce
MIPS code in ELF format (which is what I needed). I would be glad to
answer any questions for you; just send me Email.

-Ken Greenberg
-- 
Ken Greenberg     |     It takes nine months to make a baby, no matter
ken AT rahul DOT net     |     how many pregnant women are assigned to the task.
Los Gatos, CA     |		-Fred Brooks

- Raw text -


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