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 |
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 |
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 |
/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 |
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 |
# 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 |
/usr/bin/sleep 2
make[6]: /usr/bin/sleep: Command not found
This one is even easier to solve, by again editing makedef:
change
to
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 |
/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
add it for example under the line that says
Also change the following line (line 85 after the previous edit):
msg = sys_errlist[errno]; |
msg = sys_errlist[errno];
to
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 |
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 \(\) ]; 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 |
#if [ -n "$nograph" ]; then
# MOLMOLDEV=TTY/NO
#elif [ -n "$MOLMOLDEV" ]; then
# true # already set
#elif [ -n "$localdev" -a \(\) ]; 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!