Cross-compiling for AmigaOS 3.x


Introduction:

I guess I'm not the only one that doesn't have access to a classic Amiga anymore, but still would like to compile the odd program for it. I setup cross-compilers to do so and thought I should share the experience and binaries I have.

The installation:

First you need to get the files for your plattform. Provided on this page are the following (only binaries, source or diffs are available at GeekGadgets):

These archives should be unpacked into /usr/local. Normally done with 'tar jxf /path/to/binutils-2.14.tar.bz2', 'tar jxf /path/to/gcc-2.95.3.tar.bz2' and 'tar jxf /path/to/gcc-3.4.0.tar.bz2' if /usr/local is the current directory. If you installed the OS4 cross-compilers already these will happily live in the same folder as those. If you didn't, issue this command after extraction: 'export PATH=/usr/local/amiga/bin:$PATH'. Add it to .bashrc or where you seem fit. Try the newly installed cross-compiler with this command: 'm68k-amigaos-gcc -v' it will tell you what version of gcc you have installed.

Version 2.95.3 of gcc contains the c and c++ compilers, except for ppc-linux, couldn't get c++ to compile there. I will see if I can fix that anytime soon. Lack of ppc-linux doesn't help :). gcc 3.4.0 includes c, c++ and objc support.

/usr/local/amiga/m68k-amigaos/
/include
/lib
/sys-include
/proto
/exec
/libraries
and so on...

The SDK:

First off, get ixemul, libnix and libamiga and unpack these in /usr/local. They should install includes and libs into /usr/local/amiga/m68k-amigaos/include and /usr/local/amiga/m68k-amigaos/lib.

Second, get NDK 3.9 (includes only) and unpack into /usr/local, it should install includes into /usr/local/amiga/m68k-amigaos/sys-include.

I've included both macros.h and stubs.h in the NDK 3.9 archive now, since I've been told the new macros.h works with both gcc2 and gcc3+. Thanks to Gunther Nikl for that info.

These linklinbs are pretty common as well (I've compiled these, except libm, but haven't been able to test them properly. Can't see why they shouldn't work though):

libm, zlib, bzip2, libpng, jpeg, libmad, libogg and libvorbis. These should all be extrated into /usr/local.

The test:

This should be enough to compile programs. To test enter this small program:


#include <stdio.h>
int main()
{
    printf("Hello World!\n");
    return(0);
}


Save as hello.c and issue this command: 'm68k-amigaos-gcc hello.c -o hello' ('m68k-amigaos-gcc hello.c -o hello -noixemul' to compile with libnix instead). If everything was setup correctly, this should've built the hello program.

The end:

That's about all there is to it. Now start hacking away :)


This document is (c) 2010 Joachim Birging