Installing OBC release 3.1

From Spivey's Corner
Jump to: navigation, search

This page contains the materials and instructions you need to install release 3.1 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 3.0, this new release extends JIT support to the amd64 architecture in addition to x86 and ARM, and adds the ability under Linux to use libffi in place of hand-written wrappers to call library functions. The 64-bit runtime executes the same bytecode program as the existing 32-bit runtime, and Oberon pointers and other addresses are represented in 32 bits; the storage manager is designed to allocate storage in the bottom 2GB of the address space to make this possible. Arithmetic on 64-bit integers is supported natively on amd64 instead of using library calls as on other architectures.

Compared with release 2, the release adds support for the Oberon-07 dialect of the language.

Source code and previous versions of the binary packages linked below are available from the releases page of the compiler's GitHub repository, where there is also an issue tracker. The current version is 3.1.0, or 3.1.1 on the Raspberry Pi.

Release 3.1 is likely to be the last (or nearly the last) release of OBC, as the author no longer has a need for an Oberon compiler for use in teaching. He plans to keep it available for the foreseeable future, with bug-fixes but without further enhancements. Possibly a student project this year will result in a nice JIT backend for the MIPS processor on the Onion Omega, but that will be about all.

Debian, Ubuntu and similar x86 or amd64 Linux systems[edit]


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

Copy it to your machine, then issue the command

$ sudo dpkg -i obc_3.1.0_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

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

Raspberry Pi under Raspbian[edit]


Installation on the Raspberry Pi (any model) is the same as on other Debian-based systems, except that you need the file obc_3.1.1_armhf.deb for the ARM architecture.

Copy the file to your machine, then issue the command

$ sudo dpkg -i obc_3.1.1_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 Stretch.

Other Unix systems[edit]


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

$ git clone -b rel-3.1.0

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.

Note: development of the compiler is managed with Mercurial rather than Git, and the GitHub URL above leads to a Git repository exported from Mercurial that is updated whenever there is a fresh release or bugfix. For more up-to-date information, you can use Mercurial to clone directly the repository on Mike's server:

$ hg clone -u rel-3.1.0

The runtime system uses pointers are 32 bits wide, and has been made to work on amd64 by forcing memory to be allocated in the bottom 2GB of the address space. On x86, amd64 and ARM machines, the default runtime system includes a JIT translator; other architectures fall back to an interpreter for the bytecode, which is also used on all architectures to support profiling and debugging.

Windows systems[edit]


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-win32-3-1-0.exe or obc-win64-3-1-0.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[edit]


You need the package obc-mac-3.1.0.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[edit]

Initial release.

Known problems[edit]

  • The JIT translator will not work under SELinux, because it depends on allocating memory that is both writable and executable. The source contains an option to avoid this, but it is untested.

A numbering system for memory locations. ARM-based microcontrollers (like most bigger machines) have a single address space containing both code and data. Some other microcontroller families have separate address spaces for code and data, in what is called a Harvard architecture.

A 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.