Views
Cmgui from source
This is a guide to building cmgui from source on linux. (For building on windows see [Building cmgui on win32]? ). If all goes smoothly it should take less than an hour and a half to build cmgui from source the first time. Much of that time will be spent twiddling your thumbs waiting for things to download or compile.
Some provisos: I assume you are using bash as your shell and that your username is bob. If using a different shell you will need to use the appropriate commands that set up your environment variables. Where appropriate replace bob with your username.
I have used scp for file transfer, although if you can mount /hpc/cmiss from bioeng22 on you computer you can just use cp.
- Step 0: Install any missing packages
You will need certain packages installed to build cmgui. A basic ubuntu installation is unlikely to have all the required packages installed by default. Here is a list of commands I ran to install required packages that I was missing when building cmgui from source on a basic ubuntu installation:
sudo apt-get install libmotif-dev sudo apt-get install libmotif3 sudo apt-get install subversion sudo apt-get install build-essential sudo apt-get install libgtk2.0-dev sudo apt-get install libglut3-dev sudo apt-get install libxp-dev sudo apt-get install libxmu-dev sudo apt-get install libgtkglext1-dev sudo apt-get install libxxf86vm-devIf you don't have root access or are unfamiliar with installing packages get your sysadmin to install these for you.
- Step 1: check openmotif is installed
If you ran the commands in Step 0 it should be installed. Note that you will need to have openmotif as lesstif is no good (the uil compiler in lesstif is broken). To check whether openmotif is installed see if you have the motif library file libXm.so by typing:
locate libXm.soIf you do not have root access you may need to sudo this command
sudo locate libXm.so. If nothing comes up have a look in /usr/lib to see if it is there (the locate database may not have updated yet). You can install openmotif via apt-get. If you need more info on openmotif see http://www.openmotif.org/The latest version of openmotif is 2.3.0 beta which provides better support for wide character sets (unicode etc) than previous versions. If you have an earlier version of openmotif you may need to change your LANG environment variable to use ascii rather than utf-8. To do this in a shell:
export LANG=en_NZ
Consider adding this to your .profile file.
Note that eventually the motif version of cmgui will be superceded by the wx widgets version.
- Step 2: set up an svn client
You will need a subversion client, normally called svn on linux. To check if you have one installed type:: svn --help
You should see an appropriate help message if you have svn installed. Our server is currently version 1.4.x
- Step 3: create a cmiss root directory
A root directory for cmiss needs to be made where all code and libraries will be placed. You can create the cmiss directory wherever you wish. Tocreate one in the default home directory one up a shell and type:
cd ~ mkdir cmiss
You also need to set up an environment variable specifying the location of cmiss root, the easiest way is to do this in your .profile file. Edit your .profile file to include the line:
export CMISS_ROOT=~/cmiss
Now start up a new bash shell or source your .profile file.
- Step 4: check out the source from subversion
Assuming you have a subersion client you can check out cmgui source:
cd $CMISS_ROOT svn checkout https://svn.physiomeproject.org/svn/cmiss/cmgui/trunk cmgui
Note this is not all the code as you will also need various other libraries that cmgui depends on. These following libraries are required:
- perl_interpreter
- image_libraries
- itk
- mesa (if your OpenGL headers don't match)
Instructions on setting these libraries up are given below.
- Step 5: perl_interpreter
Check out the source code for the perl interpreter:
cd $CMISS_ROOT svn checkout https://svn.physiomeproject.org/svn/cmiss/perl_interpreter/trunk perl_interpreter
Note that while the perl interpreter is now under subversion control, the old cvs version has not been removed yet, so you could check it out from cvs if you prefer. Currently both versions are identical as no development has been done on the perl interpreter recently.
You will need to build or copy over the appropriate lib files for your operating system. Copying is easier. Someone with username bob on an i686 linux system would do the following:
cd $CMISS_ROOT/perl_interpreter mkdir lib scp -r bob@bioeng22.bioeng.auckland.ac.nz:/hpc/cmiss/perl_interpreter/lib/i686-linux/ lib
If you prefer you can try to build your libraries from scratch on your system. See [Building the perl interpreter libraries]?. Note that if you are a user external to the university, you will have to build the perl_interpreter rather than using scp.
- Step 6: image_libraries
Get the image_libraries:
cd $CMISS_ROOT svn checkout https://svn.physiomeproject.org/svn/cmiss/image_libraries/trunk/ image_libraries
The version of libxml2 included in the checkout may be outdated. Check in the folder $CMISS_ROOT/image_libraries/libxml2. Version 2.6.30 did not build in Ubuntu 8.10. The latest version can be downloaded from ftp://xmlsoft.org/libxml2/. Extract the tar.gz into $CMISS_ROOT/image_libraries/libxml2/, keeping the files in its libxml2-(version) folder, e.g. $CMISS_ROOT/image_libraries/libxml2/libxml2-2.7.2.
Next, edit the Makefile in $CMISS_ROOT/image_libraries/libxml2/. Alter the first line to update your libxml2 version, e.g.:
VERSION = libxml2-2.7.2
Save, close, and finally:
cd $CMISS_ROOT/image_libraries make
- Step 7: itk
Get the appropriate itk code for your os (eg i686-linux):
cd $CMISS_ROOT mkdir -p itk/lib scp -r bob@bioeng22.bioeng.auckland.ac.nz:/hpc/cmiss/itk/lib/i686-linux/ itk/lib scp -r bob@bioeng22.bioeng.auckland.ac.nz:/hpc/cmiss/itk/src itk
- Step 8: wxWidgets
wxWidgets will eventually replace the motif version of cmgui, providing an environment which should run on different operating systems. It is currently still possible to build the motif version. If you wish to build the wxWidgets version you will need to do the following.
Download the wxWidgets from http://www.wxwidgets.org (e.g., wxWidgets-2.8.3.tar.bz2) to your cmiss root directory. Then do:
cd $CMISS_ROOT tar jxvf wxWidgets-2.8.3.tar.bz2 cd wxWidgets-2.8.3 mkdir buildgtk cd buildgtk ../configure --disable-shared --enable-debug --with-opengl --with-gtk --with-expat=builtin make We are building wxWidgets and expat statically to try and reduce the number of runtime dependencies for the built executable.
For more information or if you have problems see [Building Cmgui with wxWidgets]?
- Step 9: mesa
mesa may be required if the compiler is trying to link against openGL headers that do not match. Skip this step and if your code does not compile come back to it:
cd $CMISS_ROOT mkdir -p mesa/lib mkdir mesa/include scp -r bob@bioeng22.bioeng.auckland.ac.nz:/hpc/cmiss/mesa/lib/i686-linux/ mesa/lib scp -r bob@bioeng22.bioeng.auckland.ac.nz:/hpc/cmiss/mesa/include/i686-linux/ mesa/include
- Step 10: compile cmgui
Change into the cmgui directory and type make:
cd $CMISS_ROOT/cmgui make
By default it will build cmgui-motif-debug and place it in a bin directory under a subdirectory of the operating system name. Check that compilation has created an executible by looking at this directory:: ls $CMISS_ROOT/cmgui/bin/i686-linx
You should see an executable file
cmgui-motif-debugYou can specify other targets such as
- cmgui-motif (optimised version)
- cmgui-gtk (gtk toolkit version)
- cmgui-console (no graphics, just command line)
- cmgui-motif-debug-memorycheck (keeps track of all memory access and deaccess and reports leaks etc.)
If you wish to compile the wxWidgets version use:
cd $CMISS_ROOT/cmgui make cmgui-wx-debug WX_DIR=${CMISS_ROOT}/wxWidgets-2.8.3/buildgtk/(If compiling the wx version a lot, you may want to set the WX_DIR variable in your cmgui makefiles. Edit
$CMISS_ROOT/cmgui/source/developer.Makefile, and add a line likeDEVELOPER_OPTIONS += WX_DIR=/home/blackett/cmiss/wxWidgets-2.8.4/bin/). - Cross compiling
If you are using the [Cross Compilers]? environment from /hpc/cmiss you MUST have CMISS_ROOT set to /hpc/cmiss for the cmgui makefile to set up various variables correctly for the cross compile environment.
Non-Institute members --mpiron, Sun, 04 Feb 2007 00:40:03 +1300 reply
Is there a way for non-Institute members to download the necessary files to install CMGUI? I'm a bioengineering student from Belgium.
The steps above mentioning an SCP command cannot be performed, because I don't have any login information.
(I'm a newbie Linux user).
Thank you
Non-Institute members --blackett, Mon, 05 Feb 2007 09:02:50 +1300 reply
The program can be downloaded as a single executable file for many unix and unix like platforms at the release centre page http://www.cmiss.org/ReleaseCenter
There are also source tarballs, although as you can see the build process is a little complex and involved. I have put a little bit of work into a total build package for linux but that still needs work.
Finally the subversion code repository is now publicly available for anonymous checkout at https://svn.physiomeproject.org/svn/cmiss
external users and required libraries --andre, Fri, 06 Jul 2007 14:20:06 +1200 reply
Would be good to document the required steps for building/downloading all the required libraries (e.g., perl_interpreter and ITK) for external people unable to scp them from Auckland.
image_libraries --andre, Fri, 06 Jul 2007 14:22:22 +1200 reply
Are all the different versions of the image_libraries required? looks like the svn checkout gets 6 versions of ImageMagick, 2 of libpng 5 of libxml, and 4 libtiff, all of which takes quite a while to download...
image_libraries --blackett, Fri, 20 Jul 2007 08:28:11 +1200 reply
Some of the old versions of libraries in image_libraries should be removed from the subversion.
external users and required libraries --blackett, Fri, 20 Jul 2007 08:36:09 +1200 reply
Showing how to build all the libraries and dependencies was the motivation behind the "total build" tar ball that I worked on last year.
This was unfortunately never really completed and I think now that it should be build with a wxWidgets version rather than Motif.
I added a tracker item: http://www.cmiss.org/cmgui/tracker/499
external users and required libraries --andre, Tue, 11 Nov 2008 21:07:47 +1300 reply
http://www.cmiss.org/cmgui/tracker/499 is now https://tracker.physiomeproject.org/show_bug.cgi?id=880
Werror during Step 10 --jzha263, Mon, 24 Nov 2008 16:25:53 +1300 reply
"treat warnings as errors" error was encountered in step 10, making the wxWidget version. The Werror flag had to be removed from the file common.Makefile in $CMISS_ROOT/cmgui/source. All instances of -Werror in the file were removed. CMGUI was successfully built after that.