Installing OBC release 2.9

From Spivey's Corner
Jump to: navigation, search

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

Note that there is a later release of the compiler

  • 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.8, this new release features a simplified and hopefully more robust garbage collector, and fixes a number of minor problems in the JIT.

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 the file obc_2.9.7_i386.deb (32 bits) or obc_2.9.7_amd64.deb (64 bits).

Copy it to your machine, then issue the command

$ sudo dpkg -i obc_2.9.7_i386.deb

(or the equivalent for amd64). That's all there is to it!

Even on an amd64 system, the compiler implements the INTEGER type with 32 bits.

(This package was built on an Ubuntu 14.04 system.)

Other x86 Linux systems


The compiler and associated software is packaged as a binary tarball, which can be installed in a place of your choice. You need the file obc-linux-2.9.7.tar.gz. To install it under /usr/local:

$ tar xfz obc-linux-2.9.7.tar.gz
$ cd obc-linux-2.9.7
$ ./configure
$ make
$ sudo make install

The above package was linked on an Ubuntu 14.04 system. If it doesn't work because you have a different version of glibc, let me know, and I'll see if we can do something about it.

The GUI debugger depends on the GTK libraries (including gtksourceview-2.0) to display its interface, and you will need to have them installed in order to use it. If you have a recent version of the Gnome editor gedit installed, then you probably have the necessary libraries already. On amd64 systems, you will need to build from source in order for the GUI to use the 64-bit version of the GTK libraries.

Raspberry Pi under Raspbian


The same as other Debian-based systems, except that you need the file obc_2.9.7_armhf.deb for the ARM architecture. Note: this build has no 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. but only a bytecode interpreter. Everything, including the debugger, still works, though. Watch out for the forthcoming release of version 3, which will feature a JIT for the ARM.

Other Unix systems


The source code for the compiler and associated software is packaged as a source tarball. You need the file obc-2.9.7.tar.gz. After unpacking the file, you will find instructions for compiling and installing the compiler in the file INSTALL. 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.

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 x86 machines, the default runtime system includes a JIT translator. We don't have much experience yet with porting it to different Unix systems.

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-2-9-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; 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-2.9.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.

Known problems

  • Programs that use SYSTEM.VAL to do unsafe type conversions between LONGREAL and LONGINT can result in bytecode that confuses the JIT's register allocator. Workaround: help out the register allocator by assigning the result of SYSTEM.VAL to a local variable.

Version history

Bugfix: GC maps for dynamic arrays containing pointers; bugfix: taking address of a cast; bugfix: JIT runs out of registers.
Bugfix: code buffer overflow handled bettter; bugfix: NIL is allowed as a procedural parameter; FOR loops with step 0 now result in a warning.
Added XFlush call to XYPlane.
obdump copes with larger linecounts; bugfix: empty comments (**); Windows runtimes are stripped to reduce executable sizes; minor build fixes.
Bugfix: LEN(a, 0) is the first dimension; bugfix: constant folding of ASH function; changes needed to build on Raspberry Pi; fixed formatting of runtime errors reported via debugger; source files may have extension .mod in addition to .m.
Fixed a bug in the garbage collector; fixed rounding error that sometimes caused Random.Roll(n) to return n; a couple of other minor bug fixes.
Improved code for array indexing; implemented missing LDIF and STIF instructions; added Mac OS build.
Personal tools