NDK Setup for the VBCC Compiler

vbcc

vbcc is a highly optimizing portable and retargetable ISO C compiler by Volker Barthelmann. It supports ISO C89 and a subset of C99. It's also still being developed and offers a variety of target distributions and cross-compiling options. Best of all: It's free.

The AmigaOS distribution of vbcc is maintained by Frank Wille and can be downloaded here. Frank added support for the NDK3.2 in vbcc 0.9h, so you'll have to get this version or a later one.

Installation of the compiler is simple: You'll have to download the vbbc main archive suitable for your system plus at least one Amiga-related target archive, first. We'll assume you want to compile on Amiga natively, so we choose:

(download by right-clicking the link & select "save as")

Open a shell. We assume you have lha installed. If not, get it here (download by right-clicking the link & select "save as"). Extract both archives to a temporary location, e.g. RAM:.

lha x vbcc_bin_amigaos68k.lha ram:
lha x vbcc_target_m68k-amigaos.lha ram:

Install the NDK by extracting the archive to the desired location, e.g.:

lha x NDK3.2.lha Data:AmigaOS/NDK3.2

Now run the Installer script for both vbcc's main archive and target archive via Workbench. During installation of the target, you'll be asked for the location of the NDK's header files. Enter the directory you installed the NDK3.2 in and select the subdirectory "include_h":

Depending on the location you have chosen during install, an assign named vbcc: will be created. In our example, we installed vbcc to "Work:Develop/vbcc" and the NDK3.2 to "Data:AmigaOS/NDK3.2", so your paths may be different. Edit your s:user-startup file using TextEdit or similar, and make sure it'll contain the following:

;BEGIN vbcc
assign >NIL: vbcc: Work:Develop/vbcc
assign >NIL: C: vbcc:bin ADD
setenv VBCC vbcc:
assign >NIL: vincludeos3: vbcc:targets/m68k-amigaos/include
assign >NIL: vincludeos3: Data:AmigaOS/NDK3.2/include_h ADD
assign >NIL: vlibos3: vbcc:targets/m68k-amigaos/lib
assign >NIL: vlibos3: data:AmigaOS/NDK3.2/lib/ add
;END vbcc

The line "assign >NIL: vlibos3: data:AmigaOS/NDK3.2/lib/ add" won't be created by vbcc installer, so you'll have to add it yourself if you want to compile programs making use of debug.lib.

Reboot.

And that should be it. :-)

Let's enter a small C program to verify the procedure. You can use any text editor of your choice, but we'll use TextEdit now to create the file for demonstration purposes:

Textedit HelloWorld.c

Enter the following lines:

#include <dos/dos.h>
#include <proto/dos.h>

int main()
{
	Printf("Hello, World!\n");
	return(RETURN_OK);
}

Save, close Textedit and compile & link the program with:

vc +aos68k -o=HelloWorld HelloWorld.c

And that's it - you should have a binary named "HelloWorld", now. The program uses the Printf() function of dos.library instead of the compiler-supplied printf(). So you'll be fine, if it compiles successfully. Thanks go to Frank Wille for his comments, corrections and additions to the AmigaOS3.2 NDK. We also thank Volker Barthelmann and Frank for creating and maintaining this wonderful compiler.

Tags