skinner@saturn.ucsc.edu (Robert Skinner) (10/20/88)
I am trying to cross-compile C++ on a CRAY, since the Cray doesn't have CC. I use the -Fc option to produce a regular C file, then compile normally. This leaves me with the following routines undefined: _main _new _delete _new and _delete are obviously from libC, I think I can fake the routines for them. What about _main()? What does _main() do besides construct all static objects? If I avoid using static objects, can I insert a dummy _main() and get away with it? Has anybody else tried this sort of thing, with a Cray in particular? Are there any hidden traps that are going to completely blow me out of the water? thank you for your support Robert Skinner skinner@saturn.ucsc.edu PS: I know that the CRAY only supports 15 character variable names. I'll write a name masher and pipe all the files through it first. That should be easy enough to deal with.
mikem@otc.oz (Mike Mowbray) (10/24/88)
In article <5180@saturn.ucsc.edu>, skinner@saturn.ucsc.edu (Robert Skinner) says: > I am trying to cross-compile C++ on a CRAY, [...] > This leaves me with the following routines undefined: > _main _new _delete > What does _main() do besides construct all static objects? If I avoid > using static objects, can I insert a dummy _main() and get away with > it? This function of _main is quite important. If you don't do it properly, static ctors and dtors won't get called, which means that your cout calls will dump core, among other things. This will indeed blow you out of the water in most cases. You need to do the same post-linking that CC normally does (with the aid of munch). To do this I think you really need source for the translator. Mike Mowbray Network R&D |||| OTC || ACSnet: mikem@otc.oz TEL: (02) 287-4104 UUCP: {uunet,mcvax}!otc.oz!mikem SNAIL: GPO Box 7000, Sydney, Australia
hansen@pegasus.ATT.COM (Tony L. Hansen) (10/25/88)
> I am trying to cross-compile C++ on a CRAY, [...] > This leaves me with the following routines undefined: > _main _new _delete To do C++ (cfront-based) cross-compilation, you will need these things: o a set of C cross-compilation tools, which would include cc, ld, ar, nm o a size-alignment table for the remote machine as created by the szal program run on that remote machine o a copy of cfront running locally o a version of CC which invokes the cross-compilation versions of cc, ld, and nm. It needs to invoke cpp with the options appropriate to the remote machine, such as "-U local-machines-symbol" and "-D cray". The size-alignment table used should be the one mentioned above. o Using this version of CC, you need to create a local copy libC.a. Compile all of the .c files into .o files, using the -c option to CC, and use the cross-compilation version of ar to create libC.a. If you don't have a version of ar, ship the .o's across to the remote machine, do the ar there, and ship the libC.a back. o Now modify CC again so that it points to the cross-compilation version of libC.a. o You might have to modify the munch/patch line to work with your systems output from nm. The new version of CC should now be usable for doing a complete cross-compilation of C++ programs. I've used the above technique for doing cross-compilation to several other systems. Tony Hansen att!pegasus!hansen, attmail!tony