Installation guide1 Modula-3: Critical Mass Modula-3, cm32
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>.
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:
- cd
- mkdir cm3-boot
- cd cm3-boot
- 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
- Extract with
tar zxvf cm3-min-POSIX-LINUXLIBC6-5.4.0.tgz
- Execute cminstall with
sudo ./cminstall
- Answer the questions that allow to install the bootstrap compiler
on your system considering to answer:
- 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.
- If the question is about libraries (Motif, X11, ODBC):
- If you have not installed the libraries in other path, the most proper
answer is: /usr/lib
- 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:
- 'Would you like to change the library names? [yes]:' no
- 'Would you like to continue nonetheless? [yes]:' yes
or hit return
- If the questions is about a system command (vi, gcc, as, ar), the
default answer is frecuently the correct one:
- 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]
- if the question is repeted, verify the program path is correct calling
the correspondant program with the answered path in other console.
- When the questions end cminstall exports (copies) all the binaries
and config files to the path /usr/local/cm3 and gives some final indications.
- Please verify that the final message is that the files have been copied
succesfully to the path /usr/local/cm3. You can check this with the
command
ls /usr/local/cm3/*
- If you have answered wrong some question the cminstall can be stopped
(Ctrl+C) and no files will be copied, you can restart again and answer
all the questions from step 1.
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
- Inside the quake table SYSTEM_LIBS add the following entry before
the last variable of the array, TCP:
...
"PTHREAD" : [ "-L/usr/lib",
"-lpthread" ],
"TCP" : [ ]
}
- 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"
]
- Save the changes.
- Try the following command to verify the correct functioning and configuration
file calling:
- /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.
- 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.
- 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) :
- cd
- mkdir cm3-5.4
cd cm3-5.4
- or you can use something like /usr/local/src/, where maybe need sudo
if the owner of the directory is root
- cd /usr/local/src
- sudo mkdir cm3-5.4
cd cm3-5.4
- 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
- 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
- If have downloaded the compressed file from the web page, extract
the sources with:
tar zxvf cm3-src-all-5.4.0.tgz
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).
- Use the compiler with pthread support variable PTHREAD
export CM3="/usr/local/cm3/bin/cm3 -DPTHREAD"
- Let know of the the cm3 binaries:
export PATH=''/usr/local/cm3/bin'':$PATH
- Libraries to be used in cm3:
export LD_LIBRARY_PATH=''/usr/local/cm3/lib'':$LD_LIBRARY_PATH
- Configure the man pages (in some applications the variable could be
MAN_PATH):
export MANPATH=''/usr/local/cm3/man'':$MANPATH
- Save the changes and reload the new variables in the terminal executing
(or just init another session of terminal)
bash
sudo ldconfig -v
Enter to the scripts directiory of cm3 sources:
cd scripts
- 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
#....
- 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
- 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.
- 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
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!
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.
- showheap4: click on ''start'' in the ShowHeap window; this shows the pages
de objetos located in the process heap.
- 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.
- showthread6: shows a record of 1 line by thread of the application and its real
time states .
- If the showthread or correspondant window don't appear verify the
applications calling it directly:
showheap
shownew
showthread
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.
Repeat the same tests on a non privileged account adding in ~/.bashrc
the same variables of enviroment of section 3.2.
Periodically you can check the sources from cvs repository.
- Download and uncompress (http://www.cvsup.org)
tar zxvf cvsup-snap-16.1h.tar.gz
cd cvsup-snap-16.1h
- 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
- Apply the patch
patch -p 1 < cvsup-snap-16.1h-cm3-5.2.7.patch
- Now have to do a little modification in FileAttr.m3
vi suplib/src/FileAttr.m3
- In the line 744, replace the existing line and put this
tz: UNTRACED REF Utime.struct_timezone;
- Type the make command to build the package
make
- 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
- Now make the installation
sudo make install
- 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
- 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.
- 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
- Add after line 22 the following
*default tag=.
- Save the changes
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
- with GUI
cvsup -L 2 supfile.cm3
- without GUI
cvsup -g -L 2 supfile.cm3
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.
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.
-
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