Personal tools
You are here: Home cmgui Wiki Cmgui from source
Views

Cmgui from source

last edited 3 weeks ago by pbier

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
    

    If 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.so
    

    If 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
       cd 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-debug

    You 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 like DEVELOPER_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.


comments:

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

Contributing to this site

Please add to the wiki any relevant information that you think might be useful to other users of this website. For example, you might like to contribute your experiences, questions and answers.

You are encouraged to contribute to this site regardless of your level of experience. Contributions are welcomed from new and regular visitors.

If you ask a question and receive an answer from a developer you should record it in the wiki. This information is extremely useful and can help other users overcome the same problem.

See how to add and edit pages for more information.