About

The following tutorial is about creating a cross compiler for the Amiga 68k on OSX. We are going to compile and use vbcc along with the Amiga NDK version 3.9.

Compile Cross Assembler

The cross assembler will be responsible of assembling the output of the compiler vbcc. The first step is to download the source code either:

Then extract:

tar -xpvf vasm.tar.gz
cd vasm

and build the binary:

make CPU=m68k SYNTAX=mot

Finally, install the binary:

mkdir -p /opt/vbcc/bin
cp vasmm68k_std vasmm68k_mot vobjdump /opt/vbcc/bin

Compile the Linker

Download the vlink package either:

Next, uncompress:

tar -xpvf vlink.tar.gz
cd vlink

and build:

mkdir objects
make

Then finally install:

mkdir -p /opt/vbcc/bin
cp vlink /opt/vbcc/bin

Build the Compiler

Now, for the compiler, download it either:

Uncompress and prepare the sources:

tar -xpvf vbcc.tar.gz
cd vbcc

Now, edit Makefile and remove -DHAVE_AOS4 to make sure it will not build for OS4 if you want OS3 compatibility.

After that, build:

mkdir bin
make TARGET=m68k
make TARGET=m68ks

and install:

cp bin/vbcc* bin/vc bin/vprof /opt/vbcc/bin

Preparing the Environment

The system headers and libraries for the m68k Amiga platform must be downloaded as well as the standard C library. You can see the official webpage for more details, but for m68k, the following files have to be downloaded:

or, from our local mirror:

You can install lha using either MacPorts or Homebrew to melt the lha file.

Next, unzip and melt the archives in the same directory:

unzip vbcc_unix_config.zip
lha x vbcc_target_m68k-amigaos.lha

and install the files:

export VBCC=/opt/vbcc
mv config $VBCC/
mv vbcc_target_m68k-amigaos/targets $VBCC/

Amiga OS Development

If you want to use Amiga libraries, you will additionally need the OS headers and libraries. You can get the last NDK 3.9:

and extract it to a directory (we will use the same directory path):

lha x ndk39.lha
mv ndk_3.9 /opt/vbcc/

Testing

First, export the following environment variables:

export NDK=/opt/vbcc/ndk_3.9
export NDK_INC=$NDK/include/include_h
export NDK_LIB=$NDK/linker_libs
export VBCC=/opt/vbcc
export PATH=$VBCC/bin:$PATH

And now attempt to compile a simple C program:

hello.c
#include <stdio.h>
 
int main(int argc, char **argv) {
  printf("Good day!\n");
  return 0;
}

with vc:

vc +aos68k -I$NDK_INC -L$NDK_LIB -o hello hello.c -lamiga

Or, to compile a samble from the NDK:

cd $NDK/Tutorials/ARexx/Host
vc +aos68k -I$NDK_INC -L$NDK_LIB RexxShell.c -lamiga

Selecting Default Architecture

The last step would be to configure vbcc to use m68k as the default:

cd $VBCC/config
ln -sf aos68k vc.config

and then edit $VBCC/config/aos68k and append -I$NDK_INC at the end of the -cc and -ccv lines.


osx/amiga_cross_compiler.txt · Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.