Installation guide1 Modula-3: Critical Mass Modula-3, cm32



Contents

1 (k)ubuntu (x86-32 bit) edgy packages

sudo apt-get install <packages>

packages that must be installed

sudo apt-get install autoconf automake autotools-dev build-essential cpp-4.1 freeglut3-dev gcc-4.1 gcc-4.1-base libgl1-mesa-dev libglu1-mesa-dev libice-dev libltdl3 libncurses5-dev libsm-dev libx11-dev libxau-dev libxaw7-dev libxaw-headers libxdmcp-dev libxext-dev libxmu-dev libxmu-headers libxpm-dev libxt-dev mesa-common-dev odbcinst1debian1 texinfo unixodbc x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-xext-dev xtrans-dev dpkg-dev g++ m4 flex lesstif2-dev lesstif-bin

In the case some package is not found in the repositories, just check your /etc/apt/sources.list for commented repositiories, uncomment it and make an sudo apt-get update and try again the installation. If this does not work too, you can download directly the packages (with the dependencies if not installed yet) for your distro on http://packages.ubuntu.com/
Download and install it with sudo dpkg -i <package>.

2 Bootstrap compiler installation

The compiler and runtime of cm3 are written on Modula-3, so it's necessary if you have not installed another cm3 compiler install a minimal compiler (bootstrap) in order to compile the complete sources of cm3:

In an administrator account (I suppose not root) do in the terminal (I suppose bash) the following steps:

2.1 Make directory cm3-boot

  1. cd
  2. mkdir cm3-boot
  3. cd cm3-boot
  4. Download cm3-min-POSIX-LINUXLIBC6-5.4.0.tgz from the site http://modula3.elegosoft.com/cm3/cm3-min-POSIX-LINUXLIBC6-5.4.0.tgz and put it on the directory cm3-boot
  5. Extract with

    tar zxvf cm3-min-POSIX-LINUXLIBC6-5.4.0.tgz

2.2 Bootstrap configuration

  1. Execute cminstall with

    sudo ./cminstall

  2. Answer the questions that allow to install the bootstrap compiler on your system considering to answer:

    1. The first question is about the path of cm3 install, the default answer is between brackets [] is [/usr/local/cm3]. If you want another installation of cm3 you can choose other path. I suppose you select this option in the rest of this guide.
    2. If the question is about libraries (Motif, X11, ODBC):

      1. If you have not installed the libraries in other path, the most proper answer is: /usr/lib
      2. Any question that after been answered warns about all the files needed are not in the path you have answered (i. e libXmu.a, libX11.a at /usr/lib), will be produce two more derived questions, that you should answer: no, yes:

        1. 'Would you like to change the library names? [yes]:' no
        2. 'Would you like to continue nonetheless? [yes]:' yes or hit return
    3. If the questions is about a system command (vi, gcc, as, ar), the default answer is frecuently the correct one:

      1. Hit enter if sure of the path on your system: /usr/bin/<program> where program is either vi, gcc, ar or as. In the cases you hit enter the answer is given in the brackets [/usr/bin/program]
      2. if the question is repeted, verify the program path is correct calling the correspondant program with the answered path in other console.

2.3 Adjusting cm3 configuration options of file /usr/local/cm3/bin/cm3.cfg

Because the cm3 bootstrap cm3-min-POSIX-LINUXLIBC6-5.4.0 compiler is built with user level threads and recent linux kernels and libc libraries has problems with this threads implementation, you must specify the use of another threading implementation, system level threads, the pthread library of the Gnu/Linux system, so you must add some lines in the cm3 file (script of the builder quake3), type in the console:

sudo vi /usr/local/cm3/bin/cm3.cfg

  1. Inside the quake table SYSTEM_LIBS add the following entry before the last variable of the array, TCP:

    ...

    "PTHREAD" : [ "-L/usr/lib", "-lpthread" ],

    "TCP" : [ ]

    }

  2. You must include too the new variable in the quake array SYSTEM_LIBORDER, writing, "PTHREAD" before closing the brackets [], like in this example :

    SYSTEM_LIBORDER = [ "OPENGL", "DECPEX", "MOTIF", "X11", "TCP", "ODBC", "POSTGRES95", "FLEX-BISON", "LEX-YACC", "LIBC", "PTHREAD" ]

  3. Save the changes.

2.4 Verify cm3

  1. Try the following command to verify the correct functioning and configuration file calling:

    1. /usr/local/cm3/bin/cm3
      Check the out, if it complains about cm3.cfg verify and if there is something wrong check modified lines before on cm3.cfg file.
    2. Otherwise, the messages should begin with:
      -- building in LINUXLIBC6 --
      Just stop the process (Ctrl+C). Now there must be a directory named LINUXLIBC6 in the current directory. Do an ls and drop it. The compiler is OK.

3 Compiling cm3 sources cm3-5.4

3.1 Download the source code:

  1. Make the directory of sources cm3 in the user home path (no sudo needed for create directory download or copy sources or update the sources tree after the build) :

    1. cd
    2. mkdir cm3-5.4
      cd cm3-5.4
  2. or you can use something like /usr/local/src/, where maybe need sudo if the owner of the directory is root

    1. cd /usr/local/src
    2. sudo mkdir cm3-5.4
      cd cm3-5.4
  3. Download the sources from the site: http://modula3.elegosoft.com/cm3/cm3-src-all-5.4.0.tgz, and put in the directory . Another option is the recomended: use the cvs repository (because are the most updated sources). Download with the commands specified in http://modula3.elegosoft.com/cm3/cvs-cm3.html
  4. If have the cvsup utility also you can download the same cvs repository following the instructions on http://modula3.elegosoft.com/cm3/cvsup-cm3.html
  5. If have downloaded the compressed file from the web page, extract the sources with:

    tar zxvf cm3-src-all-5.4.0.tgz

3.2 Enviroment

Adjust the variables os the administrator user to allow recognize the path of cm3. Just add in the file ~/.bashrc in the bottom the following lines: (Execute the command vi ~/.bashrc to add the lines).

  1. Use the compiler with pthread support variable PTHREAD

    export CM3="/usr/local/cm3/bin/cm3 -DPTHREAD"

  2. Let know of the the cm3 binaries:

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

  3. Libraries to be used in cm3:

    export LD_LIBRARY_PATH=''/usr/local/cm3/lib'':$LD_LIBRARY_PATH

  4. Configure the man pages (in some applications the variable could be MAN_PATH):

    export MANPATH=''/usr/local/cm3/man'':$MANPATH

  5. Save the changes and reload the new variables in the terminal executing (or just init another session of terminal)

    bash

3.3 Update cache

sudo ldconfig -v

3.4 Compile

Enter to the scripts directiory of cm3 sources:

cd scripts

  1. Edit the file cm3/scripts/def-std-pkgs.sh with vi and change the lines 149 until 152, introducing the symbol # (commenting) in the beginning of each line, to not compile in this build the Juno-2 editor (after the build you can undoit this change an compile it because in this build the bootstrap compiler has user level threads and in some cases will produce badly the editor):

    # The Juno-2 graphical constraint based editor

    #....

  2. Execute the following scripts from console. The first cleans the source tree and then actually build cm3:

    sudo ./do-cm3-std.sh realclean

    sudo ./do-cm3-std.sh buildship

  3. If the process breaks beacuse of an error from the system linker ld or a problem with cm3.cfg file, just check the file or the libraries of the very first step and install the missing if there are, and restart the build without the realclean command (just sudo ./do-cm3-std.sh buildship), this restart without recompilling the work already done.
  4. The final messages if everithing goes well will be on the terminal the copied sources and binaries:

    ../src/wheeler => /usr/local/cm3/pkg/mentor/src/wheeler

    MiscFmt.m3 MiscFmt.i3 Wheeler.m3 Wheeler.i3

    CharArraySort.m3 CharArraySort.i3

    ../src/zpaper => /usr/local/cm3/pkg/mentor/src/zpaper

    Fn.i3 AlgFn.m3 AlgFn.i3 ViewFn.m3

    ViewFn.i3 ViewMFn.m3 ViewMFn.i3 ViewHisto.m3

    ViewHisto.i3

    . => /usr/local/cm3/bin

    mentor

    ==> /your/path/cm3-5.4/cm3/m3-demo/mentor done

4 Test (m3-demo)

4.1 Verify program mentor

Call from the terminal the graphic application

mentor

A Trestle window should appear. In the window MENTOR, click on Sessions -> Dgraph algorithm with the (Depth First Search algorithm animation) in the square at the left part of window), open the views (click on the labels of the square at right part of the window); several views are available. Click on Go button at the top level of the window and enjoy the animations!

4.2 Realtime information

You can see realtime activity in the process of Modula-3 programs in a window calling the program with the following parameters:

mentor @M3showheap=showheap

mentor @M3shownew=shownew @M3update=1

mentor @M3showthread=showthread

The program would not start but it does a window where you can actually start the process.

  1. showheap4: click on ''start'' in the ShowHeap window; this shows the pages de objetos located in the process heap.
  2. shownew5: shows the new objects allcaoted in the porcess heap with the names of created objects at the rate of 1 second (@M3update=1 or a integer seconds). Click on Start and click off over the Start label.
  3. showthread6: shows a record of 1 line by thread of the application and its real time states .

All the runtime parameters can be used at the same time with a Modula-3 program, just put the parameters in the same command.

The compiler could be runned with this parameters, and you can also get linker an other useful information of times of the compiler phases. Just make cm3 -? and see the available options.

4.3 Tests on a ``non administrator'' users

Repeat the same tests on a non privileged account adding in ~/.bashrc the same variables of enviroment of section 3.2.

5 Updating cm3 sources tree with cvsup

Periodically you can check the sources from cvs repository.

5.1 If don't have cvsup installed, compile it with cm3:

  1. Download and uncompress (http://www.cvsup.org)
    tar zxvf cvsup-snap-16.1h.tar.gz
    cd cvsup-snap-16.1h
  2. Download the file which is on http://modula3.elegosoft.com/cm3/cvsup-snap-16.1h-cm3-5.2.7.patch on the cvsup-snap-16.1h directory
  3. Apply the patch
    patch -p 1 < cvsup-snap-16.1h-cm3-5.2.7.patch
  4. Now have to do a little modification in FileAttr.m3
    vi suplib/src/FileAttr.m3
  5. In the line 744, replace the existing line and put this
    tz: UNTRACED REF Utime.struct_timezone;
  6. Type the make command to build the package
    make
  7. Now prepare the man section of your distro,
    ls /usr/local/man/man8 if doesnt exist make it with
    sudo mkdir /usr/local/man/man8
  8. Now make the installation
    sudo make install

5.2 Download and adjust the sup file

  1. Make a new directory (i.e in the home path of the same administrator as above, I sippose not need sudo)
    cd
    mkdir cm3-cvs
    cd cm3-cvs

  2. Download the sup file from http://modula3.elegosoft.com/cm3/cvsupfile.cm3 and put it on a directory cm3-cvs where you will have the sources.
  3. Modify the lines 16 and 17 to the path of your preference, I call it below /your/path, replace it by the appropiate
    vi cvsupfile.cm3
    *default base=/your/path/cm3-cvs

    *default prefix=/your/path/cm3-cvs

  4. Add after line 22 the following
    *default tag=.
  5. Save the changes

5.3 Download cm3 updated the sources

If this is the first time you call the program you will download the all sources. This will take several minutes.

cd /your/path/cm3-cvs

5.4 Updating the sources from cm3 repository

Apply the same commands as above each time you want to update, this will just download the changes to your source tree.

You can check a log of the changes in the m3commit mail list https://mail.elegosoft.com/pipermail/m3commit or directly in the cvs web repository http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3 for new changes.

5.5 Compile cm3 updated sources

You will use the current compiler so don't install the boostrap again, just use the compiler installed in /usr/local/cm3 (so the original source tree is not used). The new build will replace the current binaries and sources on /usr/local/cm3.

See the section 3.4 Compile (avoid the step 1).

Inside cm3-cvs, will have two directories (cm3 a sup) and the supfile. cm3 is the one of the current sources.

About this document ...

Installation guide1 Modula-3: Critical Mass Modula-3, cm32

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -no_subdir -split 0 -show_section_numbers /tmp/lyx_tmpdir6285Xv9hGw/lyx_tmpbuf0/InstallationGuidecm3-Modula-3.tex

The translation was initiated by Daniel Benavides on 2007-06-07


Footnotes

... guide1
Universidad Nacional of Colombia-Ingenierķa. Free software group EIDOS. http://dis.unal.edu.co/eidos, https://linux.unal.edu.co.
... cm32
Elego Software Solutions http://modula3.elegosoft.com/cm3
... quake3
http://modula3.elegosoft.com/cm3/doc/help/cm3/quake.html
... showheap4
See man showheap
... shownew5
See man shownew
... showthread6
See man showthread
Daniel Benavides 2007-06-07
Hosted by www.Geocities.ws

1