[ghemical-devel] ghemical, mopac7 and gcc-4

Jean Bréfort jean.brefort at normalesup.org
Thu Jun 15 10:45:02 EDT 2006


Hi,

I encountered a huge problem when trying to compile ghemical using
gcc-4.1.1
The reason was I used --with-mopac7 when configuring libghemical.
libmomac7 needs either libg2c or libf2c. The former was provided by
gcc-3.x but is not anymore available with gcc-4. The result was that
ghemical did not link because of missing symbols (f2c symbols) as -lf2c
was not explicit anywhere.
Worse, glut was not detected, and glut is a requirement for ghemical,
IMHO configure should fail when glut is not present, or we should change
the code to not use glut when it is not available. glut and other
libraries were not detected by configue because the tests went after
pkg-config calls which set LDFLAGS, so the test had -lmopac7 (and no
f2c).

Explicitly adding -lf2c to LDFLAGS did not help since f2c requires a
MAIN__ symbol.
I could not understand at firs how things could work with gcc-3.x and
libf2c, since we never provided the MAIN__ symbol. I found a ghemical
version built whith f2c, and ldd ghemical gave libg2c.so !!

I only found a somewhat dirty solution :
in libmopac7.pc.in, add -f2c -m to LDFLAGS when f2c is used and
-DUSE_F2C to CFLAGS

in ghemical/src/main.cpp, add:
#ifdef USE_F2C
extern "C" {
int MAIN__ ()
{
  return 0;
}
}
#endif

This just works ;-)

I cannot access svn since I have no account and the anonymous access
does not work.

Cheers,
Jean





More information about the ghemical-devel mailing list