[ghemical-devel] mopac7 -- please do not use g2c.

Daniel Leidert daniel.leidert.spam at gmx.net
Sun Feb 24 23:32:57 EST 2008


The Debian team is currently trying to make the transition from the old
G77 to gfortran. During this, the following bug report was opened
against the mopac7 Debian package: http://bugs.debian.org/465723
regarding the proposal to drop the dependency on libg2c.so. The
following is my answer after a first review of the problem. It contains
a few issues+patches for the FORTRAN code too. However I would be
interested what you as upstream think about the following proposal:



I wonder if we really win something by changing from libg2c0-dev to
libf2c2-dev. Maybe an alternative (I'm not familiar enough here, so
please don't hesitate to comment my proposal):

We could take fortran/Makefile.am and put the library creation stuff
into it and use the FORTRAN sources. instead of the f2c-generated C
sources. That requires copying libmopac7.c and libmopac7.h from src/
into fortran and running autoreconf. So we can maybe drop the
libg2c0/libf2c2 dependency completely for the library. Also the
application seems to have a FORTRAN source.

I attach the necessary Makefile.am to this mail. However, atm this fails
for me at:

> esp.f:948.72:
>          OPEN(21,STATUS='NEW')                                          
>                                                                        1
> Error: The STATUS specified in OPEN statement at (1) is 'NEW' and no FILE specifier is present
> [..]
> esp.f:2357.72:
>          OPEN(21,STATUS='NEW')                                          
>                                                                        1
> Error: The STATUS specified in OPEN statement at (1) is 'NEW' and no FILE specifier is present

I'm not familiar with FORTRAN and I miss time to examine this atm.
Reading the docs I think, maybe a "scratch file" should be opened, so I
removed the STATUS stuff and then it compiles some more files. But it
stops at:

> symtrz.f:1045.30:
>       DATA TOLER,IFRA /  0.1, '????'/                                   
>                              1
> Error: Incompatible types in assignment at (1), CHARACTER(1) to INTEGER(4)

After fixing this one and a typo (s/NAMES/NAME) a few lines later (CCed
Tommi Hassinen with this mail), it compiles, but it fails with:

.libs/fdate.o: In function `fdate_':
/usr/local/src/Packages/mopac7/mopac7-1.13/fortran/fdate.c:27: undefined
reference to `s_copy'
collect2: ld returned 1 exit status

This is because fortran/fdate.c uses s_copy(). If we can replace this
one too (not hard): Is there anything that prevents us from directly
compiling the FORTRAN sources to create the library and program?


Maybe the f2c-generated C source can be held as some kind of "fallback"
if no FORTRAN compiler can be found on the system (AFAIK this is, what
f2c was developed for).

PS: You got most of this mail also to your private address. I'm sorry, I
subscribed to the list after sending this mail.

Regards, Daniel
-------------- next part --------------
SUBDIRS = c_src_bak

	aababc.f	addfck.f	addhcr.f	addnuc.f \
	analyt.f	anavib.f	axis.f		block.f \
	bonds.f		brlzon.f	btoc.f		calpar.f \
	capcor.f	cdiag.f		chrge.f		cnvg.f \
	compfg.f	consts.f	cqden.f		datin.f \
	dcart.f		delmol.f	delri.f		denrot.f \
	densit.f	depvar.f	deri0.f		deri1.f \
	deri21.f	deri22.f	deri23.f	deri2.f \
	deritr.f	deriv.f		dernvo.f	ders.f \
	dfock2.f	dfpsav.f	dgemm.f		dgemv.f \
	dger.f		dgetf2.f	dgetrf.f	dgetri.f \
	diag.f		diat2.f		diat.f		diegrd.f \
	dielen.f	diis.f		dijkl1.f	dijkl2.f \
	dipind.f	dipole.f	dlaswp.f	dofs.f \
	dot.f		drc.f		drcout.f	dtrmm.f \
	dtrmv.f		dtrsm.f		dtrti2.f	dtrtri.f \
	dvfill.f	ef.f		enpart.f	esp.f \
	etime.c		exchng.f	fdate.c		ffhpol.f \
	flepo.f		fmat.f		fock1.f		fock2.f \
	force.f		formxy.f	forsav.f	frame.f \
	freqcy.f	geout.f		geoutg.f	getgeg.f \
	getgeo.f	getsym.f	gettxt.f	gmetry.f \
	gover.f		greenf.f	grid.f		h1elec.f \
	haddon.f	hcore.f		helect.f	hqrii.f \
	ijkl.f		ilaenv.f	initsv.f	interp.f \
	iter.f		jcarin.f	linmin.f	local.f \
	locmin.f	lsame.f		makpol.f	mamult.f \
	matou1.f	matout.f	matpak.f	mecid.f \
	meci.f		mecih.f		mecip.f		moldat.f \
	molval.f			mopac7lib.f	mullik.f \
	mult.f		nllsq.f		nuchar.f	parsav.f \
	partxy.f	pathk.f		paths.f		perm.f \
	polar.f		powsav.f	powsq.f		prtdrc.f \
	quadr.f		react1.f	reada.f		readmo.f \
	refer.f		repp.f		rotate.f	rotat.f \
	rsp.f		search.f	second.f	setupg.f \
	SIZES		SIZES.orig	solrot.f	swap.f \
	sympro.f	symtry.f	symtrz.f	thermo.f \
	timer.f		timout.f	update.f	upsurf.f \
	vecprt.f	writmo.f	wrtkey.f	wrttxt.f \
	xerbla.f	xyzint.f

lib_LTLIBRARIES= libmopac7.la

libmopac7_la_LDFLAGS = -version-info 1:13:0

libmopac7_la_SOURCES = $(EXTRA_DIST) libmopac7.c

libmopac7includedir = $(includedir)/mopac7

libmopac7include_HEADERS = libmopac7.h

noinst_PROGRAMS = mopac7
mopac7_SOURCES = mopac7app.f
mopac7_LDFLAGS = -lmopac7 -lm

More information about the ghemical-devel mailing list