The GNU C Compiler with binutils and other useful tools for cross compiling software for AmigaOS. This is the AmigaPorts continuation of bebbo's amiga-gcc; fixes flow both ways.
Currently, these tools are built:
- binutils with Hunk binary format support
- gcc with frontends for C/C++/ObjC
- libnix, newlib, clib2
- sfdc, fd2sfd, fd2pragma
- vbcc, vasm, vlink
- ira (m68k reassembler)
amiga6: The legacy GCC 6.5.0bamiga13.4: GCC 13.4, unsupported but still widely usedamiga16.2: GCC 16.2, the default branch, built and tested by CI
amiga-2.46: binutils 2.46 with amigaos support and dwarf2 debugging (the default)
sudo dnf install curl gcc gcc-c++ patch autoconf automake make bison flex rsync ncurses-devel which
sudo apt install make curl gcc g++ flex bison gettext autoconf rsync libreadline-dev
Install Homebrew (https://brew.sh/) or any other package manager first. The compiler will be installed together with XCode. Once XCode and Homebrew are up install the required packages:
brew install autoconf automake bash bison coreutils curl flex gettext \
gnu-sed gnu-tar grep make wget xz
Apple ships old or BSD versions of many of these tools. Put the Homebrew GNU
versions first on PATH under their plain names, so the build machinery does
not need BSD workarounds (add these lines to your shell profile to make them
permanent):
export PATH="$(brew --prefix bison)/bin:$(brew --prefix flex)/bin:$PATH"
for pkg in coreutils gnu-sed gnu-tar grep make; do
export PATH="$(brew --prefix $pkg)/libexec/gnubin:$PATH"
done
NOTE
- With the
PATHabove,makeis Homebrew's GNU make 4.x; Apple's GNU Make 3.81 is known to produce link failures on the same machine and project, so use it for your own projects too - If you want
m68k-amigaos-gdbthen you have to build it withgccrather than the default Apple toolchain, e.g.brew install gcc@12and then:
CC=gcc-12 CXX=g++-12 make all
pacman -S curl git base-devel gcc flex rsync autoconf automake
Also note that you MUST cd into an absolute path e.g. cd /c/msys64/home/test/amiga-gcc/ before running make, or builds may fail, because some files aren't found correctly (that's a msys2 bug).
git clone https://github.com/AmigaPorts/m68k-amigaos-gcc
cd m68k-amigaos-gcc
make update
The default configuration builds GCC 16.2. Use make branch as described
under Version management if you need a different GCC branch.
Use make help to see which targets can be built.
The build performs the installation automatically, there is no separate make install step.
The default prefix is /opt/amiga. You must make sure that the target PREFIX directory
is writable for the user who is doing the build:
sudo mkdir /opt/amiga
sudo chown $(id -u):$(id -g) /opt/amiga
You may specify a different prefix by adding PREFIX=<path> to the make commands:
make all PREFIX=$HOME/m68k-amiga-gcc
Once the PREFIX directory is writable, run make all. You can use -j$(nproc) to speed up the build.
make clean
make drop-prefix
time make all -j$(nproc)
A full bootstrap takes roughly 10 to 30 minutes on current Linux hardware, dominated by multilib phases.
This packages the PREFIX folder into a redistributable archive:
make package # builds a .tar.xz archive
make package-lha # builds a .lha archive
Native builds use the build machine's OS and architecture in the filename.
Cross builds use HOST, so their filenames identify the system on which the tools
will run rather than the build machine.
The GitHub Actions workflow in .github/workflows/toolchain.yml
bootstraps the toolchain from scratch, optionally runs the gcc
testsuite under vamos, and uploads the native .tar.xz packages as build
artifacts.
By default it also Canadian-cross-builds the amiga16.2 compiler for AmigaOS
and MinGW hosts, using the published amigadev/crosstools:m68k-amigaos-gcc10
and amigadev/crosstools:x86_64-w64-mingw32 build environments. The local hosted
build Dockerfiles are not rebuilt by CI. The AmigaOS package is an .lha; the
Windows runner uses the files in setup/ to compile an Inno Setup installer
without running the generated installer. If installer compilation fails, the
workflow uploads a portable .zip instead.
Pushing a tag matching v* publishes the binary archives as a GitHub release,
with the gcc testsuite as a release gate.
You can select one of the various runtimes:
-mcrt=nix20: the libnix runtime for Kickstart 2.0+ (recommended for most projects)-mcrt=nix13: the libnix static runtime for Kickstart 1.3 (also uses headers fromndk13-include)-mcrt=newlib: the newlib-based static runtime for Kickstart 2.0+ (default, but uncommon nowadays)-mcrt=clib2: the clib2 static runtime-mcrt=ixemul: the ixemul dynamic runtime for Kickstart 2.0+, requires an installedixemul.library-noixemul: a misleadingly named alias for-mcrt=nix20(deprecated)
Always specify the runtime, even when you want the default: it affects the include path as well as the libraries, so compiling for one runtime and linking against another breaks quietly.
To check the built toolchain, run the gcc dejagnu execution tests.
This does not cover everything but it's a start. The tests run each
compiled testcase under vamos
to emulate the AmigaOS APIs, so vamos must be on the PATH.
Install dejagnu (sudo apt install dejagnu on Debian/Ubuntu,
brew install dejagnu on macOS) and amitools, in a venv to keep it
out of the system Python:
python3 -m venv .venv
.venv/bin/pip install "amitools[vamos] @ git+https://github.com/AmigaPorts/amitools.git"
source .venv/bin/activateThen run the testsuite:
make -j$(nproc) checkAlternatively, the baseboards/volamos*.exp boards run the same tests under
volamos, a Rust reimplementation of the
same idea; install it and put it on the PATH, then select it with board:
make -j$(nproc) check board=volamos(matching board=amigaos-020, board=amigaos-baserel, etc. also have
volamos-020, volamos-baserel, ... counterparts).
The Makefile provides some targets to switch to an older state for all modules.
Use make to switch all modules to a given date. You may also add the time
make v date=2021-04-01
Run make to switch all modules back to the branch
make v
This lists all modules with the last commit. Useful if you switched to a given date to show what's where.
make l
You can switch modules to different branches. E.g.
make branch mod=binutils branch=devel1
The default branches and repositories are in the file default-repos, the local state is managed in the file .repos.
See COPYING and COPYING-THIRD-PARTY.