Compiling and installing MolMol under Linux

The molmol software that is available from the website of ETH Zurich does not compile on Ubuntu Linux without some changes. It seems that it is no longer supported by ETH Zurich, but can be downloaded from several other websites (just google it). I describe below what I needed to do to get it to compile and run on Ubuntu Linux.

A summary of the installation procedure as described in the readme file follows for reference, but it does not seem to work without the changes mentioned below:

tar xvzf molmol-2k.2.0-doc.tar.gz
tar xfzf molmol-2k.2.0-src.tar.gz
 
cd tiff-v3.4
./configure
make
sudo make install
cd ..
 
cp makedef.lnx makedef
./INSTALL
make
sed -i 's/ksh/sh/g' molmol 
cd src/main
strip molmol
cp molmol ../../molmol.lnx
cd ../..
 
./molmol

First, some additional packages are needed in Ubuntu:

sudo apt-get install libmotif-dev x11proto-print-dev libxpm-dev libxt-dev

(depending on your current ubuntu installation, you may need some other packages as well. Some error messages during the installation may give you an indication of what else is needed.)

However, when I tried to compile molmol, the following error occured:

/usr/bin/gcc -I../../tools/include -Dsqrtf=sqrt -Dexpf=exp -Dlogf=log -Dpowf=pow -Dsinf=sin -Dcosf=cos -Dtanf=tan -Dasinf=asin -Dacosf=acos -Datanf=atan -Datan2f=atan2 -Dfabsf=fabs -Dceilf=ceil -O2 -I../../tools/include -Dsqrtf=sqrt -Dexpf=exp -Dlogf=log -Dpowf=pow -Dsinf=sin -Dcosf=cos -Dtanf=tan -Dasinf=asin -Dacosf=acos -Datanf=atan -Datan2f=atan2 -Dfabsf=fabs -Dceilf=ceil  -c -o RandNum.o RandNum.c
In file included from /usr/include/math.h:94,
                 from RandNum.c:29:
/usr/include/bits/mathcalls.h:55: error: conflicting types for ‘acos’
/usr/include/bits/mathcalls.h:57: error: conflicting types for ‘asin’
/usr/include/bits/mathcalls.h:59: error: conflicting types for ‘atan’
/usr/include/bits/mathcalls.h:61: error: conflicting types for ‘atan2’
/usr/include/bits/mathcalls.h:64: error: conflicting types for ‘cos’
/usr/include/bits/mathcalls.h:66: error: conflicting types for ‘sin’
/usr/include/bits/mathcalls.h:68: error: conflicting types for ‘tan’
/usr/include/bits/mathcalls.h:101: error: conflicting types for ‘exp’
/usr/include/bits/mathcalls.h:110: error: conflicting types for ‘log’
/usr/include/bits/mathcalls.h:154: error: conflicting types for ‘pow’
/usr/include/bits/mathcalls.h:157: error: conflicting types for ‘sqrt’
/usr/include/bits/mathcalls.h:179: error: conflicting types for ‘ceil’
/usr/include/bits/mathcalls.h:182: error: conflicting types for ‘fabs’
make[4]: *** [RandNum.o] Error 1

This was easily solved by editing the makedef file as follows:

change

MISSFUNC = -Dsqrtf=sqrt -Dexpf=exp -Dlogf=log -Dpowf=pow \
           -Dsinf=sin -Dcosf=cos -Dtanf=tan \
           -Dasinf=asin -Dacosf=acos -Datanf=atan -Datan2f=atan2 \
           -Dfabsf=fabs -Dceilf=ceil

to

# MISSFUNC = -Dsqrtf=sqrt -Dexpf=exp -Dlogf=log -Dpowf=pow \
#         -Dsinf=sin -Dcosf=cos -Dtanf=tan \
#         -Dasinf=asin -Dacosf=acos -Datanf=atan -Datan2f=atan2 \
#         -Dfabsf=fabs -Dceilf=ceil

At this point, I got a second error

/usr/bin/sleep 2
make[6]: /usr/bin/sleep: Command not found

This one is even easier to solve, by again editing makedef:

change

WAIT   = /usr/bin/sleep 2

to

WAIT   = /bin/sleep 2

Another error occurs that requires us to make some changes in the source code. The error message is:

/usr/bin/gcc -o molmol -I../../tools/include -I../../sg/include -I../../include  -O2 MolMol.o MolInit.o ../../lib/libcip.a ../../lib/libcmd.a ../../lib/libui.a ../../lib/libgraph.a ../../lib/libio.a ../../lib/libpu.a ../../lib/libcalc.a ../../lib/libprim.a ../../lib/libdata.a ../../lib/libattr.a ../../lib/libfileio.a ../../lib/libos.a ../../sg/lib/libsg.a ../../tools/lib/libtools.a  -L/usr/X11R6/lib -lXm -lXt -lX11 -lm -lc -lieee
../../lib/libos.a(GFile.o): In function `raiseError':
GFile.c:(.text+0x37): warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
/usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in ../../lib/libos.a(GFile.o)
/lib/libc.so.6: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[4]: *** [molmol] Error 1

The following changes to the source-code solved the problem.

Add the following line to the file ./src/os/GFile.c

#include <errno.h>

add it for example under the line that says

#include <linlist.h>

Also change the following line (line 85 after the previous edit):

msg = sys_errlist[errno];

to

msg = strerror(errno);

Molmol shoud compile now, but unfortunately the problems are not finished yet. After having stripped and copied molmol from ./src/main to molmol.lnx as in the original instructions, when we try to run it, it says:

MOLMOL 2K.2 
 
Version 2.1-2.6: Copyright (c) 1994-98 by
    Institut fuer Molekularbiologie und Biophysik, ETH Zurich
    Spectrospin AG, Faellanden, Switzerland
 
Version 2K.2: Custom version by Reto Koradi, 1999-2003
 
using Motif/OpenGL
unknown IO device

This can be solved by editing the startup script (the file called molmol):

Comment out the following lines (line 192-209):

#if [ -n "$nograph" ]; then
#  MOLMOLDEV=TTY/NO
#elif [ -n "$MOLMOLDEV" ]; then
#  true  # already set
#elif [ -n "$localdev" -a  $display =  ]; then
#  MOLMOLDEV=$localdev
#elif [ -x $xdpy ]; then
#  xdpyout=`$xdpy -d $display 2>&1 | egrep 'GLX|unable'`
#  case $xdpyout in
#    *unable*) MOLMOLDEV=TTY/NO
#              nograph=y
#              continue;;
#    *GLX*)    if [ -n "$glxdev" ]; then
#                MOLMOLDEV=$glxdev
#              fi
#              continue;;
#  esac
#fi

I hope this helps!

This entry was posted in linux, science, ubuntu. Bookmark the permalink.

36 Responses to Compiling and installing MolMol under Linux

  1. Christian Hilty says:

    Excellent instructions. Saved a lot of time.

  2. nico says:

    Thanks for the instructions! It MOSTLY works but I don't seem to have any molmol startup script... where do I find it?

    When I start molmol.lnx it starts, shows up an interface and says:
    "Menubar file could not be opened, check installation (setting of MOLMOLHOME)"

    Any clue what's the problem?

    Thanks
    nico

  3. louic says:

    The error message you get is normal. The startup script makes some settings that are necessary for molmol to work. Because you start molmol.lnx directly without the script, you get this error message.

    It can be solved by setting the environment variable MOLMOLHOME to the value of the directory where molmol is located. If you are using bash:
    # export MOLMOLHOME=/home/username/wherever/your/molmol/is/installed

    A better way is to find the startup script. It should be in your molmol directory, with the filename molmol. Do not forget to make the changes to the script as I mention above. If the script is not there I would suggest to get it from the original molmol archive you downloaded.

  4. nico says:

    Thank you for your reply. Unfortunately I don't seem to have that startup script... and exporting MOLMOLHOME does not seem to help.

    The file I have does not seem to have an INSTALL script either... I think we may be using different versions?

    I downloaded mine from:
    ftp://ftp.mol.biol.ethz.ch/software/MOLMOL/unix/molmol-2k.2.0-src.tar.Z

    Is it the same?
    Thanks
    nico

  5. louic says:

    Hi nico,

    I have the same version, but you also need to download the following file: molmol-2k.2.0-doc.tar.gz
    Despite its name, it contains more than documentation, including the essential startup script. Maybe your error message is also due to this.

  6. nico says:

    Finally, it works! Thanks for your help!

    The name of the file was indeed misleading!

  7. CJ says:

    Thank you for sharing this!!
    This really helped me to install molmol at linux box!!

  8. Ying says:

    Thanks this is really useful. Works on Debian lenny x86_64.

  9. Sulakshana says:

    Thanks for sharing the details. This helped me install Molmol on Mac. I was having problem with the installation of the menubar.

  10. Dariusz Czapiewski says:

    I have been trying to run that in a very similar manner on Fedora 13 but unfortunately I got the following information:

    ...............................................
    TO -O2 -I../../tools/include -I../../sg/include -I../../include -DFUNCPROTO -c -o MotifInit.o MotifInit.c
    MotifInit.c:29:19: error: Xm/Xm.h: No such file or directory
    MotifInit.c:30:26: error: Xm/Protocols.h: No such file or directory
    MotifInit.c: In function ‘PuMotifInit’:
    MotifInit.c:68: error: ‘XmNiconName’ undeclared (first use in this function)
    MotifInit.c:68: error: (Each undeclared identifier is reported only once
    MotifInit.c:68: error: for each function it appears in.)
    make[4]: *** [MotifInit.o] Error 1
    make[4]: Leaving directory `/usr/MOLMOL/src/motif'
    make[3]: *** [motif] Error 2
    make[3]: Leaving directory `/usr/MOLMOL/src'
    make[2]: *** [default] Error 2
    make[2]: Leaving directory `/usr/MOLMOL/src'
    make[1]: *** [src] Error 2
    make[1]: Leaving directory `/usr/MOLMOL'
    make: *** [default] Error 2

    What should I do ?

    Thank you for information in advance

  11. Dariusz Czapiewski says:

    Fortunately I've resolved above problem. I was missing libtiff library.

  12. louic says:

    Thanks Dariusz for also posting the solution to your problem, hopefully it will be of help for someone else.

  13. Simon Erlendsson says:

    Thanks a lot you really saved me a lot of time! thumbs up!

  14. sky says:

    Thanks for your sharing. I try what you said, but there are still some troubles like this

    /usr/bin/gcc -I../../tools/include -I../../sg/include -I../../include -DFUNCPROTO -O2 -I../../tools/include -I../../sg/include -I../../include -DFUNCPROTO -c -o MotifDev.o MotifDev.c
    In file included from MotifDev.c:34:
    motif_busy.h:27:27: error: X11/Intrinsic.h: No such file or directory
    In file included from MotifDev.c:34:
    motif_busy.h:31: warning: parameter names (without types) in function declaration
    motif_busy.h:33: warning: parameter names (without types) in function declaration
    make[4]: *** [MotifDev.o] Error 1
    make[4]: Leaving directory `/home/ypg/Downloads/molmol-2k.2.0/src/motif'
    make[3]: *** [motif] Error 2
    make[3]: Leaving directory `/home/ypg/Downloads/molmol-2k.2.0/src'
    make[2]: *** [default] Error 2
    make[2]: Leaving directory `/home/ypg/Downloads/molmol-2k.2.0/src'
    make[1]: *** [src] Error 2
    make[1]: Leaving directory `/home/ypg/Downloads/molmol-2k.2.0'
    make: *** [default] Error 2

    Could you help me?

  15. louic says:

    I am not sure as I did not encounter this error myself, but it looks like you need to install the development files for libxt. In Ubuntu this is the package called libxt-dev.

    Please give it a try and let me know if it solves your problem.

  16. sky says:

    Thank you very much for your help!! The problem has been solved. This is my first time to use linux. Thank you so much.

  17. louic says:

    I added this information to my blog post to make sure other molmol users that follow the steps will have libxt-dev available when they try to compile.

  18. Mikhail Simin says:

    I had to uninstall libmotif and install lesstif (including -dev) to get this working. I'm on 64bit

  19. louic says:

    The above has indeed only been tested on a 32-bit system. Thanks for sharing this information Mikhail.

  20. aurora says:

    Hi louic,
    I met a problem when I went to this step.

    cd /src/main

    I could not find "molmol", but these files:

    makedep Makefile MolInit.c mol_init.h MolMol.c MolWin.c

    I try to use different paths to install it, but got the same result. Could you help me check the reason? Thx~

  21. louic says:

    It is difficult to say what the problem is without more information. But what I can see from your comment is that the . (dot) is missing in ./src/main

  22. Mandar says:

    Indeed very useful information. Though I compiled Molmol successfully on 64bit Mandriva 2010.2, I have issue while saving the figures. Neither of Tiff, PNG, JPEG nor BMP formats are working. The error reads 'dumping of image not supported by IO device'. I can save PS file. I do see this error was dealt while porting it to OSX (http://www.finkports.info/ports/sci/molmol.html). Any suggestion will be highly appreciated. Thank you.

  23. louic says:

    Have you got the tiff and libpng libraries installed? Maybe that helps. Also check if the location of these libraries is set correctly in the Makefile.

    On the other hand, you get better quality images by exporting them as .POV and then rendering with POV-ray, so I would suggest to give that a try instead.

  24. Mandar says:

    Thanks for your reply. The libraries are in the right place and get linked to the molmol correctly.

  25. louic says:

    I think I see what the problem is, but unfortunately I have no time to fix it at the moment. It also does not have priority for me, as I always export as POV, and then render the image with POV-ray. I suggest you do the same.

    If you really need the TIFF, PNG, JPEG, BMP functionality, your link to the finkports website appears to give the solution. The files on that website are patches (diff-files), so if you learn how to use them and make the suggested modifications to a few of the files, maybe it'll work...

  26. byron says:

    Thanks for your tutorial! It helped me install on a linux machine running red hat.

  27. Frank says:

    Terrific, thanks.
    Works flawlessly on Ubuntu 10.04 LTS - Lucid Lynx

  28. Reto says:

    Hi and thanks for the nice guide. Even though molmol compiles without any errors, I get a strange behavior when I want to display a molecule in a "Ribbon" style. Molmol converts the molecule to Ribbon, but the colors are not output correctly. The 3D effects, which the Ribbon-display should normally show, are totally absent. Do you know what could be causing those problems? I have experienced this behavior both on a 64bit Ubuntu (11.04) and on a 32bit Opensuse (11.4) system.

  29. louic says:

    I have also noticed this problem, but unfortunately I don't have time to investigate it at the moment.

    If you do find a solution, please share it with everybody.

  30. Mijiddorj says:

    Thank you, but I have some errors that

    make[4]: *** [RandNum.o] Error 1
    make[4]: Leaving directory `/usr/local/include/molmol/tools/src'
    make[3]: *** [src] Error 2
    make[3]: Leaving directory `/usr/local/include/molmol/tools'
    make[2]: *** [default] Error 2
    make[2]: Leaving directory `/usr/local/include/molmol/tools'
    make[1]: *** [tools] Error 2
    make[1]: Leaving directory `/usr/local/include/molmol'
    make: *** [default] Error 2

    How to fix it?

  31. louic says:

    Hi Mijiddorj,

    If I am not mistaken you are missing the motif development files. You need several development files (source code) to compile molmol. In Ubuntu, these packages are called:

    • libmotif-dev
    • x11proto-print-dev
    • libxpm-dev libxt-dev

    I am not sure about the names in Arch linux, but probably something very similar. You should be able to install them with your package manager.

  32. Chrystel says:

    When I write make after ./INSTALL, I've got this errors :

    make tools sg src TARGET=default
    make[1]: entrant dans le répertoire « /home/chrystel/molmol »
    cd tools; make default
    make[2]: entrant dans le répertoire « /home/chrystel/molmol/tools »
    make src TARGET=default
    make[3]: entrant dans le répertoire « /home/chrystel/molmol/tools »
    cd src; make default
    make[4]: entrant dans le répertoire « /home/chrystel/molmol/tools/src »
    /usr/bin/gcc -I../../tools/include -Dsqrtf=sqrt -Dexpf=exp -Dlogf=log -Dpowf=pow -Dsinf=sin -Dcosf=cos -Dtanf=tan -Dasinf=asin -Dacosf=acos -Datanf=atan -Datan2f=atan2 -Dfabsf=fabs -Dceilf=ceil -O2 -I../../tools/include -Dsqrtf=sqrt -Dexpf=exp -Dlogf=log -Dpowf=pow -Dsinf=sin -Dcosf=cos -Dtanf=tan -Dasinf=asin -Dacosf=acos -Datanf=atan -Datan2f=atan2 -Dfabsf=fabs -Dceilf=ceil -c -o RandNum.o RandNum.c
    In file included from /usr/include/math.h:94:0,
    from RandNum.c:29:
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:55:1: erreur: conflicting types for ‘acos’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:57:1: erreur: conflicting types for ‘asin’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:59:1: erreur: conflicting types for ‘atan’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:61:1: erreur: conflicting types for ‘atan2’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:64:1: erreur: conflicting types for ‘cos’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:66:1: erreur: conflicting types for ‘sin’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:68:1: erreur: conflicting types for ‘tan’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:101:1: erreur: conflicting types for ‘exp’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:110:1: erreur: conflicting types for ‘log’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:155:1: erreur: conflicting types for ‘pow’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:158:1: erreur: conflicting types for ‘sqrt’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:180:1: erreur: conflicting types for ‘ceil’
    /usr/include/x86_64-linux-gnu/bits/mathcalls.h:183:1: erreur: conflicting types for ‘fabs’
    make[4]: *** [RandNum.o] Erreur 1
    make[4]: quittant le répertoire « /home/chrystel/molmol/tools/src »
    make[3]: *** [src] Erreur 2
    make[3]: quittant le répertoire « /home/chrystel/molmol/tools »
    make[2]: *** [default] Erreur 2
    make[2]: quittant le répertoire « /home/chrystel/molmol/tools »
    make[1]: *** [tools] Erreur 2
    make[1]: quittant le répertoire « /home/chrystel/molmol »
    make: *** [default] Erreur 2

    How to fix it ?
    Tanks

  33. Xu says:

    Hey, Louic,
    I wonder if you are still maintaining this blog. If you are, could you please help? I followed the above instructions, and I kept on getting this message:
    GL/GLwMDrawA.h: No such file or directory
    compilation terminated.

    I am running on Ubuntu 12.04 LTS.
    Thanks.

    Xu

  34. Xu says:

    Ha, I got it fixed. Turns out that if i get the exact files you used it works.Thanks.

    Xu

  35. Mario Schubert says:

    Hi, very useful instructions! I had the same errors with CentOS 6 as described and could fix them. However it still does not compile. I now get:
    ...
    /usr/bin/ld: cannot find -lXpm
    collect2: ld returned 1 exit status
    make[4]: *** [molmol] Error 1
    make[4]: Leaving directory `/home/marios/SW/molmol/src/main'
    make[3]: *** [main] Error 2
    make[3]: Leaving directory `/home/marios/SW/molmol/src'
    make[2]: *** [default] Error 2
    make[2]: Leaving directory `/home/marios/SW/molmol/src'
    make[1]: *** [src] Error 2
    make[1]: Leaving directory `/home/marios/SW/molmol'
    make: *** [default] Error 2

  36. QSEValeriabs says:

    I see your site needs some fresh & unique articles. Writing
    manually is time consuming, but there is solution for this hard task.
    Just search for; Miftolo's tools rewriter

Leave a Reply

Your email address will not be published. Required fields are marked *