Installing OBC release 3.0

From Spivey's Corner
Jump to: navigation, search

This page contains the materials and instructions you need to install release 3.0 of the Oxford Oberon-2 Compiler and associated programs on your own computer.

  • Instructions for using the compiler are given in the user manual, which consists mainly of sections extracted from the lab manual for the Imperative Programming course.
  • There is also a page with a general description of the compiler and associated tools, including licencing information and acknowledgements.

Compared with release 2, this new release features support for the Oberon-07 dialect of the language, together with a JIT implementation of the virtual machine on both x86 and ARM.

Source code and previous versions of the binary packages linked below are available from the downloads page of the compiler's BitBucket repository, where there is also an issue tracker. The current version is 3.0.7.

Note that recent 64-bit PCs implement an instruction set that is known as 'amd64' (because it was invented by AMD), even if the processor was actually made by Intel.

Debian, Ubuntu and similar x86 or amd64 Linux systems


The compiler and associated software is packaged as a Debian archive that is installed under /usr. You need either the file obc_3.0.7_i386.deb (32 bits) or the file obc_3.0.7_amd64.deb (64 bits).

Copy it to your machine, then issue the command

$ sudo dpkg -i obc_3.0.7_i386.deb

(or the equivalent for amd64). Doing this may produce a message about unmet dependencies, and you can resolve them with the command

$ sudo apt-get -f install

On some minimally-configured amd64 systems, it may be necessary to add i386 as an additional architecture for package installation. If there are still problems, then try

$ sudo dpkg --add-architecture i386
$ sudo apt-get -f install

This is necessary because the OBC runtime system is a 32 bit program.

Even on an amd64 system, the compiler implements the INTEGER type with 32 bits, and compiled program run in 32 bit mode, because the JIT generates only i386 code.

(This package was built on an Ubuntu 16.04 system, but should work on other Debian-based systems.)

Raspberry Pi under Raspbian


Installation on the Raspberry Pi (any model) is the same as on other Debian-based systems, except that you need the file obc_3.0.7_armhf.deb for the ARM architecture. This release features a JIT for the ARM for the first time.

Copy the file to your machine, then issue the command

$ sudo dpkg -i obc_3.0.7_armhf.deb

If you get a message unmet dependencies, you can resolve them with the command

$ sudo apt-get -f install

This package was built under the Raspbian version that is based on Debian Jessie.

Other Unix systems


The source code for the compiler and associated software is available on BitBucket:

$ hg clone -u rel-3.0.7

After cloning the repository, you will find instructions for compiling and installing the compiler in the file README. Building the compiler requires OCaml and TCL, both of which come as standard packages on all good Unix distributions. Building the debugger (which is selected by giving the option --enable-debugger) requires development versions of the GTK libraries, including gtksourceview2.0.

The bytecode interpreter assumes that pointers are 32 bits wide, and won't build on architectures that have 64-bit pointers. On common 64-bit architectures, however, it is simple to build it in 32-bit compatibility mode. Just specify CC='gcc -m32' at the configure stage; on amd64 this happens automatically.

On x86 and ARM machines, the default runtime system includes a JIT translatorA compiler that is embedded in the execution environment for a virtual machine, and translates code for the virtual machine into native machine code just before each procedure is called. After translation, the native code remains in memory and can be used if the same procedure is called again, but the code is thrown away when the program terminates. Either each procedure (or some other fragment of the program) is translated when it is called for the first time, or an interpreter and a translator co-exist, and procedures are translated if they have been called more than a few times.; other architectures fall back to an interpreter for the bytecode, which is also used on all architectures to support profiling and debugging.

Windows systems


For all modern (read: 32-bit or 64-bit) Windows systems such as Windows 2000 and Windows XP, Windows Vista, Windows 7 (and probably Windows 8 (and very likely Windows 10)), you need the installer obc-win-3-0-7.exe. When asked, you can choose to Run the installer, or if you prefer, save it on the desktop, then double-click it to start the installation process. The installer will ask various questions about where to install the compiler, and so on. It's OK to press the Return key and accept the default answer each time. I'm not sure, but it may be necessary to restart Windows after installing for the compiler to work; it certainly won't do any harm. The compiler can then be invoked by the command obc at the Command Prompt.

Since Windows makes a fuss about installing applications that have not been digitally signed, I'll show you some screen shots so you know what to expect. The screenshots are from Windows 7 and a previous version of OBC; no doubt those from later versions of Windows will be similar but more scarily worded. If you download the installer, then double-click on the downloaded file, you will see this warning:


It's OK to click on Run here. Next you will see another warning:


You can safely click on Yes, and the installer will start.


From this point on, you can safely accept the default answer to every question.


The default is to install OBC under Program Files.


Ready to go.


Installation almost complete.


There's a README file that gives a few details.


The installer is finished; now you may have to restart Windows before using the compiler.

Macintosh systems


You need the package obc-mac-3.0.7.pkg. Clicking on the link will start the Mac OS installer; just click through all the defaults to install the compiler and associated software under /usr/local. To use the compiler, you'll need to have /usr/local/bin in your path. You can set this up by including the line

export PATH=/usr/local/bin:$PATH

in the file ~/.profile.

Version history

Allow qualified type names as labels in Oberon07 typecase statement. Fixed a register allocator bug that led to a segfault.
Fixed another procedural argument bug.
Fixed a bug with type-checking of arguments with procedure types.
Reinstated simultaneous assignment; added dependency on libc6:i386 on amd64; fixed a compiler crash on large global pointer arrays.
Various minor issues.
Fixed debugger for Mac OS X; enabled unary minus for LONGREAL.
-07 flag enabled under Windows; record fields are exported read/write in Oberon07.
First release.

Known problems

  • The JIT translator will not work under SELinux, because it depends on allocating memory that is both writable and executable. (Various proposed workarounds are too messy to contemplate.)
Personal tools