[MMTK] missing libnetcdf.so & other desasters

Andrew Dalke dalke@bioreason.com
Tue, 18 May 1999 21:20:26 -0600

Eugene Leitl <eugene.leitl@lrz.uni-muenchen.de> said:
> I'm having some trouble in installing MMTK

> This is a glibc Linux box,

> There is no Makefile.pre.in in the source tree,

My guess is you installed Python from an RPM since, as I recall,
it doesn't have Makefile.pre.in.  It wouldn't be in the source
tree because the file is created during Python's configuration.  

I believe you need to install the "python-devel" RPM.  From
Oliver Andrich's site (mind the line fold):

| The always helpful and required Makefile.pre.in can be found in
| the documentation directory of this package in /usr/doc

(Though why it's in /user/doc is a question I cannot answer.)

Looking at the rest of your output, the multipole code doesn't
compile because of the lines:
> grep: Makefile: No such file or directory
> (cd mpole; make libmpole.a CC="")

MMTK gets the compiler to use by grepping the Makefile for CC.  No
CC was found, and because compile.py doesn't check if the grep
failed, the empty string gets passed onwards.

Hmmm, looking at that source -- Konrad, here's a few change

]    source = os.path.join(os.path.join(lib, 'config'), 'Makefile.pre.in')
]    if os.path.exists(source):
]        os.system('cp ' + source + ' .')

Using shutil.copy makes this more portable; though granted, the code
already assumes the existance of Makefiles so it isn't really portable
to MS Windows and Macs :)

Also, there's a useful module called "commands" (don't know if it's
Python 1.5 specific).  If you import it, you can replace:

] os.system("make -f Makefile.pre.in boot")
] cc = string.strip(os.popen("grep '^CC=' Makefile").read()[3:])
] os.system("cd dpmta; " +
]   "find . -name Makefile\\* -exec csh ../fix_dpmta_makefile {} \\; ; "
]   "make CC='" + cc + "' DFLAGS='-DSERIAL -DVIRIAL -DMACROSCOPIC' " +
]            " serial")
] os.system("make")


def run_or_exit(cmd):
  status, text = commands.getstatusoutput(cmd)
  if status:
    print "Could not execute command:", cmd
    print text
  return text

run_or_exit("make -f Makefile.pre.in boot")
cc = string.strip(run_or_exit("grep '^CC=' Makefile").read()[3:])
run_or_exit("cd dpmta; " +
    "find . -name Makefile\\* -exec csh ../fix_dpmta_makefile {} \\;")
run_or_exit("cd dpmta; " +
    "make CC=" + commands.mkarg(cc)[1:] + \

This will catch if any errors occur, and the "mkarg" will prevent
the code from failing when people do things like:
  CC=CC -DQUIT='q'