Cross-compiling / 2016-08-12 18:37:37

One possibility is to use a PC, running Windows and Cygwin, to develop, compile, and test Classic AmigaOS programs, using WinUAE, before transferring them to a Classic Amiga. To cross-compile classic AmigaOS programs on Windows, there are two choices:

 

AmiDevCpp

TBP
 

Cygwin and GCC

To cross-compile AmigaOS programs on Windows using Cygwin, you essentially need Cygwin and an AmigaOS cross-compiler and utils. So, you must have:

  1. A Window-operated computer and Cygwin installed: Cygwin provides a good documentation so I won't repeat it here. I will assume that Cygwin is correctly installed and works. You should include some development tools as needed, for example Flex and Bison.
  2. A cross-compiler: Zerohero provides everything that you need on this Web page, which provides all the details to install the cross-compiler without problems. Unfortunately, as of 2012/02/13, Zerohero's page is down, so I try to reproduce the steps as well as provide the required files below:
    1. Download the cross-compiler GCC v3.4.0 at m68k-amigaos-gcc-3.4.0.tar.bz2. Extract the content of m68k-amigaos-gcc-3.4.0.tar.bz2 into /usr/local/.
    2. Download the cross-compiler utils v2.14 at m68k-amigaos-binutils-2.14.tar.bz2. Extract the content of m68k-amigaos-binutils-2.14.tar.bz2 into /usr/local/.
    3. Download the LibNIX v1.2 libraries at libnix-1.2.tar.bz2. Extract the content of libnix-1.2.tar into /usr/local/.
    4. Download the IXEmul v48.0 libraries at ixemul-48.0.tar.bz2. Extract the content of ixemul-48.0.tar.bz2 into /usr/local/.
    5. At this point, in Cygwin, typing:
    6. /usr/local/amiga/bin/m68k-amigaos-gcc.exe -v
      

      should return:

      Reading specs from /usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/specs
      Configured with: ../gcc-3.4.0/configure 
                       --prefix=/usr/local/amiga
                       --target=m68k-amigaos
                       --enable-languages=c,c++,objc 
                       --enable-haifa
                       --enable-sjlj-exceptions
                       --disable-shared 
                       --disable-libstdcxx-pch
      Thread model: single
      gcc version 3.4.0
      

      Update 2016/01/10: if you receive:

      C:/Cygwin/usr/local/amiga/bin/m68k-amigaos-gcc.exe: 
      error while loading shared libraries: cygintl-3.dll: 
      cannot open shared object file: 
      No such file or directory
      

      then copy the file cygintl-3.dll into C:\Cygwin\bin.

    7. Then, the following piece of code should compile and run on your classic Amiga or in WinUAE:
    8. #include <stdio.h>
      int main()
      {
          printf("Hello World!\n");
          return 0;
      }
      
    9.  Enjoy!