How to build AmigaOS4 cross-compiler (Binutils 2.23.2 & GCC 8.3.0) on CYGWIN

  • up
  • down

NOTE: all images are clickable for urls or fullsize images !



A year ago I wrote an article about building AmigaOS4 cross-compiler on MSYS2 just to try something different than Cygwin, which most of the time used by many amigaos4 developers as the cross compiler environment. And of course, MSYS2 can be used, but it has one disadvantage in comparing with Cygwin when it comes to porting from UNIX: clashes between win32 and Linux paths. And so, cmakes, autoconfs, and some other tools will bring you errors about clashing of "C:" vs "/".

Sure, if you write your apps for AmigaOS4 and cross-compile them, then it does not matter what your choice: MSYS2 or Cygwin. But if you do the porting work from Unix, and projects are big enough with the need of CMake, Autotools, and co, then you will be in need to fix path clashes.

Because of that, and because it seems the topic of some interest, I wrote this little how-to which I hope will be of use for developers who willing to do cross-compiling work, but don't want to lose their time to understand how to install it all.

...Prepare for compiling...


As noted on Cygwin's site "Cygwin is a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows". In human words, it means that this is some environment that we run and it gives us a nice shell with a scrollbar in which we can operate like we in Unix shell. All those "ls", "mkdir", "rm" and all sort of seds, awks and bashes/ashes :) There we build cross-compiler for the hardware we need (in our case for AmigaOS4) by Cygwin's GCC, and then use ready cross-compiler for produce amigaos4 binaries. The advantage of that is that we can use all range of up2date packages like CMake, Autoconf, Git, Subversion, Perl, Bison, Flex, Python and alt, and speed of x86 hardware (especially when you can build it with -j4). For example, building Irrlicht Engine on x5000/020 take about 20 minutes, while on some icore i5 with few 2.7ghz cores, with parallel building it takes just 2-3 minutes. Then you just simply transfer ready binary to real amigaos4 machine to test.


After we install Cygwin, we the same as with the case of MSYS2 will use the latest adtools repo, where Sebastian Bauer (sba1) maintain recent GCC and Binutils. At the time of writing the article, this is Binutils 2.23.2 and GCC 8.3.0. This time it also will be built with the support of LTO by default (it was changed later in adtools repo to have LTO enabled by default).

For cross-compilers purposes I use some HP notebook / icore 2.7ghz with windows10 onboard and the version of Cygwin we will use there are x64, but for x86 all will be probably the same, just installation binary will be different.

So, firstly we grab installer: and run it.


There you choose a directory where to install it, answer few usual questions, choose the mirror from where download stuff (you can choose any, I usually choice first one) and then it will bring you a window where you choose what to install:


At first, there you choose none. Just press "next/next", so it will install only the necessary minimum. And then later you can update your setup by only packages you need, to avoid having a lot of unneeded stuff.
(Of course, you can install everything we need right at the beginning, without installing a "pure" minimum, and then updating. Just witch that way you will get into "how to update packages" from start, and will have fewer issues later).

Once it has done (pretty fast, the whole installation will have only 115mb of size at this point), you just go to the directory where you choose to install it and run "Cygwin.bat":


At this point, you, of course, do not have GCC which you need to build a cross-compiler, or anything else adtools may need, or any sort of tools/parsers/languages you may need when you doing porting work. So, let's install it.

Updating of Cygwin's deps (when you need newer Autoconf, or newer CMake, or newer anything, which happens from time to time) not _that_ intuitive as one may hope, but once you get in, all will be fine.

To update you don't run any "apt-get" or "yum" or whatever else from Cygwin's console. Instead, you AGAIN run your

Then there usual next/next thing, choice of mirror, etc. Then once the window where you choose packages to install come up, you choose in the "View" (placed at left) "Full" and in the search filed you type packages you need to install.

Like you type "GCC", there will be a list of many, choice "gcc-core", hit in the dropdown image to choose a version of it, then remove from search field your "gcc", and type the new name of packages.

In the end, you should choose that:

libtool (not Cygwin one, but pure one)
wget (that one need to download SDK from Hyperion server)

See on the image above how it all should look like, and of which versions:


Then "Next", it will say that need more deps ((sure there will be many) to set this up, so again "next".

After our "update" installation is done, go to your Cygwin's console, type "gcc -v" to see that it installed and type some simple test case to check that Cygwin's GCC works.


... AmigaOS4 CrossCompiler...


Now, its time to install adtools (our cross-compiler) with the latest SDK, and all necessary dependencies need it to build it properly.

But firstly you should do set for git some magic settings without which you may have issues with building process:

  1. git config --global ""
  2. git config --global "Your Name"

After that, we do a clone of adtools repo and doing some other preparation work. Just copy+paste these strings:

  1. cd /
  2. mkdir /amiga
  3. cd /amiga
  4. git clone
  5. cd adtools
  7. git submodule init
  8. git submodule update
  10. gild/bin/gild clone
  11. gild/bin/gild checkout binutils 2.23.2
  12. gild/bin/gild checkout gcc 8

Take care, that one of the latest string with "clone" command will take time which depends on your internet connection. The "adtools" directory after "clone" finished will be about 1 GB. Next 2 commands apply amigaos4 specific patches to Binutils and GCC 8, they fast.

After that, we have downloaded everything we need from adtools repo, and what we need next, is to build it properly with the latest SDK.

Then, we also install "lhasa". This is lha packer/unpacker on Unix, and we need that for adtools scripts to be able to unpack downloaded from Hyperion's server SDK.

  1. cd /amiga
  2. git clone
  3. cd lhasa
  4. ./
  5. make
  6. make install

And not only that. In current adtools build scripts, there is a little issue: it downloads NOT latest SDK for some reason, it download 53.24, while our current public one is 53.30. So, we fix that ourself:

in /amiga/adtools/native-build/makefile , on line 39 we change that:


on that


After that we ready to build a cross-compiler!

Just go to the to /amiga/adtools directory and type:

make -C native-build gcc-cross CROSS_PREFIX=/usr/local/amiga

It will take a while. Taking into account that today's PC all multicore, add -j4 at the end so to do parallel building and to speed things up.

Once it has done (it may take time too, depends on how fast your hardware is), all that you need is just issue our magic "export PATH=/usr/local/amiga/bin:$PATH" so Cygwin will know where to find amigaos4 compiler binaries.

And !NOTE! be sure you add that line to the /home/user/.bashrc file, so you will have no needs to worry anymore about it, and it will be auto executed all the time you run your Cygwin shell.



... Testing time ...

After we have done, let's test that all works. As of now, in adtools / gcc8.3.0, "lto" is enabled by default, so let's check usual hello world:

  1. #include <stdio.h>
  2. void main()
  3. {
  4. printf("gcc 8.3.0 with lto enabled\n");
  5. }
  8. $ ppc-amigaos-gcc -flto test.c -o test
  9. $



... Tips and Tricks...


If you want to do Unix ports, you often need to know how to use ./configure on cross-compiler to build right makefiles for amigaos4. Usually, the first arguments should be:

  1. ./configure --build=x86_64 --host=ppc-amigaos --target=ppc-amigaos

After that come all the necessary options. But first 3 you can use most of the time (of course, if you on x86_64, if your build system other, you type there which one).


Today more often used CMAKE, so to made good use of it on cross-compiler, you always can follow just that way:

  1. $ cd your_project
  2. $ mkdir "build"
  3. $ cmake \
  4. -DCMAKE_SYSTEM_NAME=Generic \
  6. -DCMAKE_BUILD_TYPE=Release \
  7. -DCMAKE_C_COMPILER="/usr/local/amiga/bin/ppc-amigaos-gcc" \
  8. -DCMAKE_CXX_COMPILER="/usr/local/amiga/bin/ppc-amigaos-g++" \
  9. -DCMAKE_LINKER="/usr/local/amiga/bin/ppc-amigaos-ld" \
  10. -DCMAKE_AR="/usr/local/amiga/bin/ppc-amigaos-ar" \
  11. -DCMAKE_RANLIB="/usr/local/amiga/bin/ppc-amigaos-ranlib" \
  12. -DCMAKE_FIND_ROOT_PATH="/usr/local/amiga/ppc-amigaos/" \
  13. ..

And then "make".

For simple things that will be enough (don't miss at the end those "..", they necessary). Of course, as in the case with ./configure, other options can come too in the same way.

You may also need to adjust "flags.make" file for linking line after CMAKE generate makefiles: it will be placed in build/CMakeFiles/your_project/flags.make


I hope that small howto will be of any help for developers willing to speed up their compiling times and to have the advantage of using the latest and stable versions of autotools/parsers/buildsystems/etc.


Blog post type: