CM3 5.5.1 Installation on Ubuntu 7.10 and Similar GNU/Linux Distributions

(c) 2008-2009 by Elego Software Solutions GmbH

This document is published under the same license as cm3 (Critical Mass Modula3), which basically means that it is free to change and/or distribute under certain conditions, and that there is NO WARRANTY OR RELIABILITY of any kind. Refer to CM3's license information for further details.

Last full review: 2008-February-16

Last minor update: 2009-April-11

Author: Neels Janosch Hofmeyr (neels@elego.de)

This document is based on these installation notes:

 https://www.opencm3.net/installation.html

However, this document gives more specific information that applies to Ubuntu 7.10 and possibly other Ubuntus and GNU/Linux distributions.

(It has been reported to work for Ubuntu 8.04)

Here we go...

=========================================================================

Prerequisites:

To follow these instructions as they are, you need write access to /usr/local. You may choose to do the installation as root entirely, but you would have to make sure root's environment variables are set correctly. It is easier (and safer) to give a standard user access to /usr/local like this, where `fred' stands for your username:

  sudo -s
  addgroup local
  usermod -a -G local fred
  chgrp -R local /usr/local
  chmod -R g+rw  /usr/local
  exit  # exits root shell to become fred

In order for the group changes to take effect, you might have to relogin your user (end X session and login again).

Now, you are user fred and can run the commands given here as they are.



Before you start, be sure to have these packages installed:

  gcc (the GNU compiler collection)
  binutils (for ar and as)
  flex (for libfl.a)
  libncurses5-dev (for libtermcap)

Furthermore, cminstall will look for the following packages/libraries, which are only necessary if you want to develop applications that use these libraries; you can choose to not install these and ignore errors from cminstall as described below. Otherwise, install these packages:

  libpq-dev (for libpq.so)
  freeglut3-dev (for libGL.so, libGLU.so)
  unixodbc-dev (for libodbc.so)
  libmotif-dev (for libXm.so)
  libx11-dev (for a series of libX*.so files)

Also, in order for cminstall (below) to find some of the X11 libraries, you have to create symbolic links:

  cd /usr/lib
  sudo ln -s libXmu.so.6 libXmu.so
  sudo ln -s libXaw.so.7 libXaw.so

(If any other library file is not found, try to locate it using packages.ubuntu.com and install the appropriate package or add symbolic links to account for slight name differences as above)

=========================================================================

First, let's do the minimal binary installation.

Download a cm3-min-POSIX-LINUXLIBC6* (or cm3-min-LINUXLIBC6*) package to your Desktop, from

  https://www.opencm3.net

(i.e. one of

  https://www.opencm3.net/download.html
  https://www.opencm3.net/uploaded-archives/index.html
  https://www.opencm3.net/snaps/snapshot-index.html

).

Note that most earlier minimal binaries do not work, so stick with d5.5.1 or later. The following versions are known to succeed:

  cm3-min-POSIX-LINUXLIBC6-d5.5.1-2008-01-24-03-35-01.tgz
  cm3-min-POSIX-LINUXLIBC6-d5.6.0-2008-02-13-03-35-02.tgz
  cm3-min-POSIX-LINUXLIBC6-d5.7.0-2008-04-24-14-00-04.tgz

You will find an appropriate checksum on

  https://www.opencm3.net/checksums.php3

or just use the commands from this screenshot:

"

  $ md5sum cm3-min-POSIX-LINUXLIBC6-d5.7.0-2008-04-24-14-00-04.tgz 
  ba70f9511a2bd3da912935dbcf3df423  cm3-min-POSIX-LINUXLIBC6-d5.7.0-2008-04-24-14-00-04.tgz

  neels@dub:~/elego/SafeCVS/install 
  $ wget -q -O - https://www.opencm3.net/checksums.php3 | grep cm3-min-POSIX-LINUXLIBC6-d5.7.0-2008-04-24-14-00-04.tgz
  -rw-r--r-- 1 neels   m3  8215951 2009-04-11 22:51 uploaded-archives/cm3-min-POSIX-LINUXLIBC6-d5.7.0-2008-04-24-14-00-04.tgz
  596342621 8215951 uploaded-archives/cm3-min-POSIX-LINUXLIBC6-d5.7.0-2008-04-24-14-00-04.tgz
  ba70f9511a2bd3da912935dbcf3df423  uploaded-archives/cm3-min-POSIX-LINUXLIBC6-d5.7.0-2008-04-24-14-00-04.tgz

"

Note that the tarballs do not unpack to a subdirectory but to the current directory, so run these commands:

  mkdir ~/cm3-min
  cd ~/cm3-min
  tar xzf ~/Desktop/cm3-min-POSIX-LINUXLIBC6-d5.6.0-2008-02-13-03-35-02.tgz
  ./cminstall

Ideally, cminstall will just succeed. If it asks any questions, that's because it could not find some library. Below are the would-be correct answers.

Note that, if one of the libraries is not installed and if you furthermore choose to skip that library, you can answer the questions like shown for OpenGL and X11 below: first choose the default by hitting enter, then answer no, finally answer yes.

(Again, note that none of these questions have to be answered if the libraries are all being found)

  Where would you like the system installed? /usr/local/cm3 
  What should be the default text editor for new Reactor users? /usr/bin/vi
  Where are the flex/bison libraries? /usr/lib
  Where are the Postgres95 libraries? /usr/lib
  Where are the OpenGL libraries? /usr/lib
  The libraries libGL.so libGLU.so are not present in the chosen directory.
  Would you like to change the library names? no
  Would you like to continue nonetheless? yes
  Where are the ODBC libraries? /usr/lib
  Where are the Motif libraries? /usr/lib
  Where are the X11 libraries? /usr/lib
  The libraries libX11.so libICE.so libSM.so libXt.so libXext.so libXmu.so libXaw.so are not present in the chosen directory.
  Would you like to change the library names? no
  Would you like to continue nonetheless? yes
  Where is your C compiler? /usr/bin/gcc
  Where is your library archiver? /usr/bin/ar
  Where is your assembler? /usr/bin/as

That's all for cminstall. You have installed the minimal cm3 compiler to /usr/local/cm3.

Now, we need to register cm3's path locations (not entirely unlike the instructions given by cminstall's output).

(The following two sudos are needed regardless of write permission to /usr/local)

To adjust PATH, as root, edit the file

  /etc/environment

(e.g.

  sudo gedit /etc/environment

) and add the PATH element /usr/local/cm3/bin, to yield a line like this:

  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/cm3/bin"

To adjust your library path, run

  sudo -s
  echo /usr/local/cm3/lib > /etc/ld.so.conf.d/cm3
  exit

, which creates a new single-line file in /etc/ld.so.conf.d/. (Note that `sudo echo ...' does not work because of the `>' pipe.)

To check whether this worked, make sure that the cm3 path elements are added to the environment variables. First, you have to open a new shell to update the environment (just run `bash' or open a new terminal window). Then run

  echo $PATH

which should print a line including /usr/local/cm3/bin -- something like

  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/cm3/bin:/usr/local/pgsql/bin

. Then, try running

  cm3 -version

, which should print something like

Critical Mass Modula-3 version d5.6.0-2008-02-13-03-35-02
  last updated: 2008-01-31
  compiled: 2008-02-13 04:01:27
  configuration: /usr/local/cm3/bin/cm3.cfg

. Great, the minimal binary installation is now complete! However, there is not much you can do with this cm3, yet.

=========================================================================

Let's continue with downloading and compiling the full cm3 sources.

Upon writing this file, the newest available stable tarballs (version 5.4.0) are too old. So, you have to go about downloading the cm3 sources from CVS like this:

(CVS instructions adapted from https://www.opencm3.net/cvs-cm3.html )

  cd   # (go to your home directory)
  cvs -d :pserver:anonymous@modula3.elegosoft.com:/usr/cvs login

When prompted for a password, just hit Enter.

Now you can choose to take the exact state that worked when writing this file, or to use the newest available sources.

The sources that worked for me are obtained via:

  cvs -z 3 -d :pserver:anonymous@modula3.elegosoft.com:/usr/cvs checkout -D "2008-02-15 23:50" cm3

or

  cvs -z 3 -d :pserver:anonymous@modula3.elegosoft.com:/usr/cvs checkout -D "2008-01-24 23:52" cm3

The most recent sources, as of the time that you are running the command, are obtained via:

  cvs -z 3 -d :pserver:anonymous@modula3.elegosoft.com:/usr/cvs checkout cm3

This will download the complete cm3 sources and may take a while.

(I added a `-z 3' argument to use level 3 compression for transferring the data, to speed up the download.)

=========================================================================

Now we're ready to start compiling the full-featured cm3 compiler, using the minimal cm3 compiler from above:

  cd ~/cm3/scripts
  ./do-cm3-core.sh buildship
  ./install-cm3-compiler.sh upgrade
  ./do-cm3-std.sh buildship

These lines will compile for a long time, producing lots of output. Make sure that each of them exited without errors. If some of the libraries were missing upon cminstall (above), some packages may not compile successfully. It may help to run

  ./do-cm3-std.sh buildship

a few more times.

[TODO: how to exclude certain packages from compilation and shipping]

If these commands complete without issuing error messages in the last few lines, your cm3 installation was probably successful. Again, verify that your full-featured cm3 is working. Run:

  cm3 -version

and expect similar output as above, but showing data matching the compiled version:

Critical Mass Modula-3 version d5.6.0
  last updated: 2008-01-31
  compiled: 2009-04-11 23:05:21
  configuration: /usr/local/cm3/bin/cm3.cfg

=========================================================================

You can now free some disc space.

You will definitely want to remove the minimal binary files. You won't need them anymore:

  rm -rf ~/cm3-min

If you want to make changes to the cm3 compiler itself, you can keep the sources at ~/cm3 for rebuilding at a later stage. Otherwise, just remove these as well:

  rm -rf ~/cm3

If you also remove the downloaded files from your Desktop, this leaves your home directory as it was before you started the installation.

=========================================================================

Congratulations, you have just installed Critical Mass Modula3!

Thank you for using Critical Mass Modula3 - for further questions, feel free to contact m3-support@elego.de