[comp.sys.amiga.tech] GNU's ANSI C compiler

fche@db.toronto.edu (Frank Eigler) (05/27/89)

Before I undertake this task on my own, it would be Good to know if
anyone else has already ported GNU's UNIX C compiler to the Amiga.  On the
Suns here we use it almost exclusively because it is so much better
(smaller, faster code) than the supplied one.

It probably wouldn't be a stand-alone beast, but some sort of a replacement
for Manx's or Lettuce's own.  In any case it would be a more than useful
attempt.

If you know of anyone who has tried / is trying / will be trying this
port, could you let me know?

--Frank

-- 
__________________________________________________________________
  Frank Ch. Eigler                The Hack BBS _ (416)-265-3984 //
                                    /\ /\/\ / / \  /\          //
fche@db.toronto.edu                /__X    X /  _ /__\     \\ //
{uunet,watmath}!utai!db!fche      /  / \  / \\__//    \     \X/

limonce@pilot.njin.net (Tom Limoncelli) (05/27/89)

Maybe this should go in the "Commonly asked questions" section?  The
answer is no, not yet, and until you get virtual memory on an Amiga
it's not likely.  I think the executable alone is very huge.
...or at least I've been told :-)

-Tom
-- 
 Tom Limoncelli -- tlimonce@drunivac.Bitnet -- limonce@pilot.njin.net
       Drew University -- Box 1060, Madison, NJ -- 201-408-5389
   Standard Disclaimer: I am not the mouth-piece of Drew University

thad@cup.portal.com (Thad P Floryan) (05/28/89)

The question arose concerning the size of the GNU ANSI C compiler.

I have it running on my 3B1 systems (68010) and present below a directory
listing for your perusal.  The gcc, cc1 and cpp executables shown below were
compiled by gcc itself with full optimizing and are "stripped" (e.g. no
symbols or other debugging info; prior to optimizing and stripping, they were
about twice the shown sizes).

If one has sufficient RAM, the compiler "should be" (famous last words! :-)
portable to and operable on the Amiga given sufficient diligence on the part
of the portee.

My belief is that cross-compilation is the ONLY sane first step.  The gcc
building process allows one to specify BOTH the executable machine (that is,
the machine on which "this" version will run) and the target machine (that is,
the machine for which the code is to be generated).  In other words, it should
be possible to have a version of gcc running on, say, my 3B1 or a Sun, and have
that version generate code for a Vax or a Sparc machine or whatever.  In theory.
I haven't tried such cross-compilation yet, but it "should" work.
Cross-compiling for the Amiga should be easier since the Amiga and 3B1 are much
alike; the GNU gcc permits 68020 and 68881 code generation, too.

Even to bring it up on the 3B1 was a royal pain, since the stock AT&T cc (pcc)
compiler could NOT compile the GNU gcc material.  And there's NO way any of the
present compilers for the Amiga will compile the (unmodified) GNU gcc sources,
either.

And before you flame that assertion, I have both the Manx 3.6a and Lattice 5.02
compilers (and Lattice c++ too), and have tried to compile the files.  Didn't
spend any time trying to hand-job it since I literally haven't the time to do
so.

One major problem deals with the HUMONGOUS "#defines" in the GNU sources, many
of which are multi-thousand bytes long.  Lattice poops out at 512 bytes, and
Manx died with some other error(s).

In any event, here are the directory listings (these are of version 1.34; the
latest version 1.35 I have on another 3B1 which isn't connected to my Amiga):

ksh 1/1667> ls -l /usr/local/bin/gcc /usr/local/lib/g*
-rwxr-xr-x  2 thad    users     12368 Apr 28 02:21 /usr/local/bin/gcc
-rwxr-xr-x  2 thad    users    484476 Apr 28 02:26 /usr/local/lib/gcc-cc1
-rwxr-xr-x  5 thad    users     33232 Apr 28 02:22 /usr/local/lib/gcc-cpp
-rw-r--r--  2 thad    users     18030 Apr 24 04:25 /usr/local/lib/gcc-gnulib
/usr/local/lib/gcc-include:
total 13
-rw-r--r--  2 thad    users       708 Dec 26 02:12 assert.h
-rw-r--r--  2 thad    users      1161 Dec 26 02:16 limits.h
-rw-r--r--  2 thad    users       776 Dec 26 02:17 stdarg.h
-rw-r--r--  2 thad    users       393 Dec 26 02:17 stddef.h
-rw-r--r--  2 thad    users         0 Feb  5 16:03 va-sparc.h
-rw-r--r--  2 thad    users      1222 Dec 26 03:23 va-spur.h
-rw-r--r--  2 thad    users       802 Feb  5 16:03 varargs.h
ksh 1/1667> 


Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

thad@cup.portal.com (Thad P Floryan) (05/30/89)

Update re: GNU ANSI C for the Amiga ...

1) I have been informed by one person that a partial port has been completed.
   HOWEVER, the indication is that only the pre-processor has been brought up
   so far (and no indication of whether more work will be spent on the other
   portions of the compiler system).  Concern was expressed regarding the
   various libraries, assembler, etc. that one would need.

   My answer:  the Native Developer Update is available from CATS; among the
   included items are the header files and `amiga.lib'.   Several assemblers
   are available either PD or freely-redistributable, and commercially.  And
   a number of support library sources are available PD, such as what
   accompanies the KCC (Kok Chen C) compiler originally from Stanford University
   and now from SRI-International (via Ken Harrenstein); the KCC compiler
   package also includes Fred Fish's sources to his complex math library (NOTE:
   "complex" meaning "x+iy" numbers and not just difficult code! :-)

2) (red-faced) I was informed by another person the "large" compiler model of
   Lattice 5.02 does not have the 512-byte "#define" limit.  In my defense, I
   only ordered the 5.02 and c++ on May 1, and with their arrival several days
   later and with the arrival of Pro-Net/-Board, I've a *LOT* of new material
   to assimilate.  :-)

Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

shs@uts.amdahl.com (Steve Schoettler) (05/31/89)

I agree with Thad that the only way to do a port is to build a cross-compiler
first on another machine.  Keep in mind that this requires about 20MB free
disk space just to work on it.  You need a directory that takes up about 10MB,
which contains source for the gcc compiler to generate amiga code (the
cross-compiler).  Then, in another 10MB directory, you need the source
for the compiler that should run on the amiga, when compiled with the 
cross-compiler from the other directory.

Based on timing from a sun, I'd guess it might take 20-30 minutes to recompile
gcc on an amiga (provided you had a gcc cross compiler running on the amiga).
One of the things that makes development slow is that all the modules
"depend" on the configuration files, so whenever you fix a tiny bug in one
of them, you have to recompile everything.  So, to make 10 changes, it
takes all day.

Fortunately, my amiga is on an ethernet with a mainframe, which can recompile
the whole gcc in about 3 minutes.  I found it reasonable to make a 
gnu cross-compiler generate amiga-style assembler and then invoke a68k
to create amiga-style .o files.  Then I pop back into another window
on the amiga to run blink.  Boy, I wish I had the source to blink so
I could run the whole thing on the mainframe.

Anyhow, it's been a real pain getting a68k to understand gcc output.  I've
had to make considerable changes to both.  I just got a new version of
a68k (2.42) and gcc (1.35), so I'll try to move my changes to these new
versions.  I can compile some trivially simple test cases, but haven't
been able to compile gcc itself with the cross-compiler.

I'll work on it for a couple more weeks, and post whatever I have then.

Steve

-- 

        Steve Schoettler
        shs@uts.amdahl.com
        {sun,decwrl,pyramid,ames,uunet}!amdahl!shs
        Amdahl Corp., M/S 213, 1250 E. Arques Ave, Sunnyvale, CA 94088

kjohn@richsun.UUCP (John Kjellman) (05/31/89)

In article <18890@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes:
>The question arose concerning the size of the GNU ANSI C compiler.
>
>I have it running on my 3B1 systems (68010) and present below a directory
>listing for your perusal.  The gcc, cc1 and cpp executables shown below were
>compiled by gcc itself with full optimizing and are "stripped" (e.g. no
>symbols or other debugging info; prior to optimizing and stripping, they were
>about twice the shown sizes).
>
>If one has sufficient RAM, the compiler "should be" (famous last words! :-)
>portable to and operable on the Amiga given sufficient diligence on the part
>of the portee.
>
>My belief is that cross-compilation is the ONLY sane first step.  The gcc

[stuff deleted about what a pain it is to port GNU CC (tell me about it :-)]

>In any event, here are the directory listings (these are of version 1.34; the
>latest version 1.35 I have on another 3B1 which isn't connected to my Amiga):
>
>ksh 1/1667> ls -l /usr/local/bin/gcc /usr/local/lib/g*
>-rwxr-xr-x  2 thad    users     12368 Apr 28 02:21 /usr/local/bin/gcc
>-rwxr-xr-x  2 thad    users    484476 Apr 28 02:26 /usr/local/lib/gcc-cc1
>-rwxr-xr-x  5 thad    users     33232 Apr 28 02:22 /usr/local/lib/gcc-cpp
>-rw-r--r--  2 thad    users     18030 Apr 24 04:25 /usr/local/lib/gcc-gnulib
>/usr/local/lib/gcc-include:
>total 13
>-rw-r--r--  2 thad    users       708 Dec 26 02:12 assert.h
>-rw-r--r--  2 thad    users      1161 Dec 26 02:16 limits.h
>-rw-r--r--  2 thad    users       776 Dec 26 02:17 stdarg.h
>-rw-r--r--  2 thad    users       393 Dec 26 02:17 stddef.h
>-rw-r--r--  2 thad    users         0 Feb  5 16:03 va-sparc.h
>-rw-r--r--  2 thad    users      1222 Dec 26 03:23 va-spur.h
>-rw-r--r--  2 thad    users       802 Feb  5 16:03 varargs.h
>ksh 1/1667> 
>
>
>Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

	Hold on, let's get this straight.  Thad is right, it IS NOT
	IMPOSSIBLE, JUST IMPROBABLE :-).

	Ken Marshall, Stan Gibbs, Case Larsen and I are working (slowly :-)
	on a port of GNU CC to the Amiga.  We (I should say Ken) have
	come up with the appropriate files to get a SUN version of GNU CC
	to produce A68K assembly output (with a little help from AWK :-).

	Our plan is to use this cross-compiling environment to compile
	the GNU stuff on the SUN, move it over to the Amiga, and from
	there re-compile it (whew!).  Of course we will need to get a
	PD clib (I heard rumors of one coming down the net sometime this
	summer .... :-), etc.

	If anyone would care to lend a hand (how good did you say your code
	was? :-).  Please EMail me and we'll talk (or type depending on
	your point of view :-).

ktm@rice.edu  (Ken Marshall)
stan@hpcvcae  (Stan Gibbs)
clarsen@garnet.berkeley.edu  (Case Larson)
kjohn@richsun.uucp  (John "KJohn" Kjellman)

	P.S. (you knew this was coming right?)

	If you know of any PD Amiga (or UNIX :-) libs we could make use
	of PLEASE LET US KNOW !!!!!


-- 
| Amiga ///.5K| Disclaimer: This is only a dream, it's only a dream ......... |
| Manic///  1K|        KJohn- The man without an Amiga :-(.                   |
|  \\\///   2K|               (How much was the A2500/3000 again ? :-)        |
|   \XX/  2.5K| kjohn@richp1 or [ purdue | cs.ubc | mcdchg ] ! richp1 ! kjohn |

doug@xdos.UUCP (Doug Merritt) (05/31/89)

In article <18890@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes:
>The question arose concerning the size of the GNU ANSI C compiler.
>
>One major problem deals with the HUMONGOUS "#defines" in the GNU sources, many
>of which are multi-thousand bytes long.  Lattice poops out at 512 bytes, and
>Manx died with some other error(s).

The X Windows system has the same problem. Their solution is to
include a C preprocessor (with big limits) in the distribution.
This is, I believe, descended from the famous DECUS cpp.

If you want I could mail it to you. Don't know whether it'd be an easy
or a hard port. I suspect easy, given its history.
	Doug
-- 
Doug Merritt		{pyramid,apple}!xdos!doug
Member, Crusaders for a Better Tomorrow		Professional Wildeyed Visionary

"Welcome to Mars; now go home!" (Seen on a bumper sticker off Phobos)

deven@rpi.edu (Deven Corzine) (05/31/89)

In article <18938@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes:

> Update re: GNU ANSI C for the Amiga ...

> 1) I have been informed by one person that a partial port has been
>    completed.  HOWEVER, the indication is that only the
>    pre-processor has been brought up so far (and no indication of
>    whether more work will be spent on the other portions of the
>    compiler system).  Concern was expressed regarding the various
>    libraries, assembler, etc. that one would need.

What I would be more interested in, at this point, would be code for
GNU CC to cross-compile for the Amiga.  I could make good use of a
cross-compiler setup such as that.  Having GNU CC on the Amiga itself
would be nice, but I don't have a system available that could support
it, anyhow.  I could, however, use a cross-compiler running on a Sun
(3/50) generating code for the Amiga...

Anyone?  (or need I look into this myself?)

Deven
--
shadow@[128.113.10.2]   <shadow@pawl.rpi.edu> Deven T. Corzine (518) 272-5847
shadow@[128.113.10.201] <shadow@acm.rpi.edu>  2346 15th St.    Pi-Rho America
deven@rpitsmts.bitnet   <userfxb6@rpitsmts>   Troy, NY 12180-2306  <<tionen>>
"Simple things should be simple and complex things should be possible." - A.K.

bryan@chroma.UUCP (Bryan Ford) (06/13/89)

In <18938@cup.portal.com>, (Thad P Floryan) writes:
>2) (red-faced) I was informed by another person the "large" compiler model of
>   Lattice 5.02 does not have the 512-byte "#define" limit...

Hmmm...I didn't know this!  Where does it say?  Has the 256-byte (or
something like that) limit on string constants been removed, or at least
increased, as well?  There's a Un*x adventure game I picked up that looks
fun and easy to port, except that it uses mega-sized string constants, so
Lattice wouldn't compile it.

				Bryan