Installing the Free Oberon-2 Compiler oo2c on eee PC

Donald Daniel, Feb 2008

This article is for people who have bought the inexpensive Asus eee PC linux laptop computer and who would like to learn how to program it using oo2c, an Oberon-2 compiler for linux. For an introduction to Oberon-2 and the oo2c compiler click here. More information about the eee PC can be found at www.eeeuser.com. Installing oo2c on the eee PC requires carefully following step by step instructions given here. In order to do computer programming, and to install oo2c, you will need to know how to use the vi editor that is already on your eee PC. Most of what you will do will be done in a terminal window. To open a terminal window simultaneously press "ctrl", "Alt", and "T" keys. A black rectangle will appear on the screen that is your terminal window. First, before attempting any of the following instructions, practice using the vi editor.

Those who are new to linux should know how to find out how to do things. For instance, to find out how to move files, type in the terminal window "apropos move | more -10". This will list the first 10 commands related to moving. Hit the spacebar to see the next 10. When you see the one you want, in this case the command "mv", you need to know how to use it. Type "man mv" and the linux manual page for the command "mv" will appear on the screen. When you are finished reading the screen hit the spacebar and the next screen of the man page will appear. When you are finished with the man page type "q" to get out. You should know the commands "mv", "cp", "rm", "mkdir" "ls" and "cd" at the very least. There is no man page for "cd", which changes the directory that you are in. "cd xxx" moves you into directory "xxx". "cd .." moves you to the directory above the one where you are. "cd" by itself moves you back to your home directory or desktop, which in this case is "/home/user".

In the procedure given here you will occasionally need superuser privileges. To execute a command as superuser type "sudo" before the command. Never use "sudo" unless expressly instructed to. Be very, very careful when executing commands as superuser. Superuser is all powerful, and can render the system unusable with the wrong mistake. In case this happens, instructions for erasing your system and restoring it to the condition it was when you first bought it are given at the end of this article.

Some software needs to be added to the eee PC before you can install oo2c. The file /etc/apt/sources.list has a list of websites where the system expects to download software. The list is adequate for the software that is already on the computer, but another site belonging to the same company that prepared the software for your computer needs to be added to the list. In a terminal window execute the command "cd /etc/apt". Then "sudo vi sources.list". You now have the file "sources.list" in the vi editor. Use the editor to add the following line after the lines already present:

deb http://xnv4.xandros.com/xs2.0/upkg-srv2 etch main contrib non-free

Then hit "Esc" key then type ":wq" to write the file and get out of the editor. Then "cd" to get back to your home directory. You will need to be connected to the internet before executing the following commands. Any connection should work whether wifi, DSL, or dialup. Next, execute the following commands very carefully. Each command will make text scroll by. The command is not complete until you see the green prompt appear again. Each time you install you should watch the screen carefully. The scrolling text will stop from time to time and you will be prompted with a question. Enter "y" to indicate "yes" to each of the prompts. Failure to do this will result in the software not being installed.

sudo apt-get update

sudo apt-get install g++

sudo apt-get install libtool

sudo apt-get install libgc-dev

sudo apt-get install make

Now you have the additional standard linux software needed to support oo2c. Now it is time to get oo2c itself. With your browser go to http://sourceforge.net/projects/ooc. Click "download" to get to the download page. Scroll down the page until you find the file oo2c_32-2.1.11.tar. Be careful, there are several files with similar names. Click on this file and your browser should give you the option to save it to disk, which you will do. When you have saved this file to your disk, you no longer need to be on the internet for the rest of these instructions. Next, you must make a place to put it. We will create a directory called "wkspc" where you can do lots of things without cluttering up your desktop, and in "wkspc" we will create "progs" where you will do your programming:


mkdir wkspc

cd wkspc

mkdir progs

cd progs

mkdir src

mkdir sym

mkdir obj

mkdir bin

These last 4 directories will all be visible in the "progs" directory. Find where the large oo2c... file was saved. "cd" to get back to your desktop. "cd M*" to get into "My Documents" which is probably where it is. "ls" to list the contents. If it is there, then "mv oo* ~/wkspc/progs" to move it to the "progs" directory. Then "cd ~/wkspc/progs" to get there yourself, and "ls" to see that the oo2c... file is there. Next the following commands, but do NOT type what is in parentheses ():


bunzip2 oo*

tar xvf oo*

cd oo*  (now you are in oo2c...)

./configure

make   (this will take 14 minutes, not finished until
        green prompt reappears)

sudo make install

make clean

If all has worked, you are now finished installing oo2c. Now it is time to test it. Click on the following link and use the "file" command of your browser and "save as" to save the article "how to program a computer" to your disk as the file "prog.html": prog.html .

Next, find where the article is saved and move it to wkspc/progs, if it is not already there. Use the vi editor to look at the article prog.html. Find "graf1". Using the editor find the line number where the program begins and the line number where it ends. Then use the editor to write it to "src/graf1.Mod". Then "vi src/graf1.Mod" and delete any "pre" tags that might be at the beginning and at the end of the program. Now in the directory "progs" execute the command:

oo2c -M graf1

bin/graf1

Notice that the above command is "bin/graf1", not "bin graf1", an easy mistake to make. When in graf1 you will press "enter" to see the graph, then type "quit" to end the program. If you saw the graph, it worked, and you are ready to start learning how to write your own programs. If you saw an error message when the program terminated, do not worry about it, it is because the program attempts to print the graph on your printer, and you did not have a printer hooked up, or the program was not properly configured to talk to your particular printer.

Since installing software is risky, you may worry that any problems you see later will be the result of installing software. You should know that this computer has one minor occasional problem that has nothing to do with the software you have installed. On rare occasions the computer will hang during shutdown and not finish shutting down. Other people have noticed this. Based on my limited experience I have two suggestions for preventing this. (1) Get the screen back to the state it was just after you logged on before you shut down; do not be down in some application when you shutdown. (2) Start the shutdown procedure by clicking the red icon in the lower right corner, not by pushing the power switch. If your computer does hang on shutdown, the two best fixes are to hold down the power switch for a minute until it finishes shutting down, or to poke the "reset" hole on the bottom of the unit with a paper clip.

SYSTEM RECOVERY. If things went horribly, tragically wrong and you would like to erase your disk and get back to brand new condition, here is how I did it. I used a secure digital card, an SD card that I bought in a camera store. The manual recommends a card more than 1G and less than 2G. A 1G card worked for me. I bought a little pocket reader/writer in the camera store that came with a USB cable. Put the SD card in the reader, plug the cable in the USB port on a Windows computer, put the eee PC system DVD in the DVD drive on the computer, and follow the instructions in the printed eee PC user guide on p.6-8 "using usb flash". After you have written the software to the SD card, unplug the USB cable from the Windows computer and plug it into the USB port on the eee PC. Steps 7 and 8 on p.6-11 of the user guide were confusing because I did not realize they referred to two different places in the BIOS. When you are ready to reboot, the guide did not say that you must hold down the "esc" key while it is booting up. You will be given a choice of where to boot from, select the USB port. After about a minute you will be asked to enter "yes" to continue. It may take 18 minutes to finish. The screen will go black before that. Tap the spacebar if you want to light up the screen again. When finished you will have a new computer again, but will not have any emails or files you had stored before the restoration. You should probably not erase the SD chip, but save it as a rescue source should you ever need it again.

up one level