Compiling Molscript under Linux

Victor Jongeneel vjongene at eliot.unil.ch
Thu Dec 7 09:07:37 EST 1995


First of all, a big thank you to all of you who replied to my previous post on 
this subject (I now have too many responses to answer individually).

As I have been asked by several people to summarize the problem and the answers 
to it, here it goes:

1) The problem.  Molscript uses an all-purpose library of FORTRAN routines that 
has to be compiled before the main program.  A system-specific source file, 
system.f, defines some of these.  All of the versions contain a few things that 
Linux and/or g77 don't support: (i) the EQUIVALENCE statement is not recognized 
by g77, but does work with f2c; (ii) system.f calls two procedures that are 
missing in the Linux libraries, etime (elapsed time) and rand (random number 
generator).  Problem (i) shows up at compile time, problem (ii) when linking 
the forlib.a library.  It seems that in some versions of Linux (not 1.2.13, 
which I use), the exit procedure also has some problems, which could be 
potentially more serious (no clean program abort on erroneous input).

2) The solutions.  The simplest solution, which I actually managed to figure 
out for myself, is to use f2c to convert system.f, and to comment out the 
SYTIME and SYRAND subroutines from the source code (they are not used by 
Molscript anyway).  They can also be, more elegantly, turned into dummy 
subroutines that generate fixed values.  The most elegant answer I received was 
from Joe Smith at Penn, who provided my with a shar file to patch the source 
code. Here it is:


---------------------------------------------------------------------------
There are a couple of functions used in Per's utility library (not
molscript itself - except exit()), which are missing from the f2c
libraries.  Unshar the stuff at the end of this message in the
molscript 'forlib' directory, run 'patch <makefile.sun.diff' and
'make'.  Something like this:

  $ cd molscript/forlib
  $ sh <shar.from.joe
  $ patch <makefile.sun.diff
  $ make


---8<--- cut here ---8<--------------------------------------------------
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1995-12-01 20:07 EST by <jes at presto>.
# Source directory was `/home/jes/pkg/molscript'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#    242 -rw-r--r-- aux.c
#    152 -rw-r--r-- makefile.sun.diff
#
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  echo 'WARNING: not restoring timestamps.  Consider getting and'
  echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
# ============= aux.c ==============
if test -f 'aux.c' && test X"$1" != X"-c"; then
  echo 'x - skipping aux.c (file already exists)'
else
shar: Saving aux.c (text)
  echo 'x - extracting aux.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'aux.c' &&
#ifdef _linux_
#include <stdio.h>
#include <stdlib.h>
X
int exit_(int status)
{
X  exit(status);
X  return 0;
}
X
float ran_(int seed)
{
X  return (double)rand()/RAND_MAX;
}
X
float etime_(float (*times)[2])
{
X  return 1.0;
}
X
#endif /* _linux_ */
SHAR_EOF
  $shar_touch -am 1018094895 'aux.c' &&
  chmod 0644 'aux.c' ||
  echo 'restore of aux.c failed'
  shar_count="`wc -c < 'aux.c'`"
  test 242 -eq "$shar_count" ||
    echo "aux.c: original size 242, current size $shar_count"
fi
# ============= makefile.sun.diff ==============
if test -f 'makefile.sun.diff' && test X"$1" != X"-c"; then
  echo 'x - skipping makefile.sun.diff (file already exists)'
else
shar: Saving makefile.sun.diff (text)
  echo 'x - extracting makefile.sun.diff (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'makefile.sun.diff' &&
33,34c33,34
< forlib.a : $(OBJ) aux.o
< 	ar ru forlib.a $(OBJ) aux.o; ranlib forlib.a
---
> forlib.a : $(OBJ)
> 	ar ru forlib.a $(OBJ); ranlib forlib.a
SHAR_EOF
  $shar_touch -am 1018094995 'makefile.sun.diff' &&
  chmod 0644 'makefile.sun.diff' ||
  echo 'restore of makefile.sun.diff failed'
  shar_count="`wc -c < 'makefile.sun.diff'`"
  test 152 -eq "$shar_count" ||
    echo "makefile.sun.diff: original size 152, current size $shar_count"
fi
exit 0

-------------------------------------------------------------------------------

Hope this will be of use to future compilers of Molscript and supporters of 
Linux!

Cheers,

Victor J.






More information about the Bio-soft mailing list