From: John Duff (jfduff_at_mtu.edu)
Date: Sat Oct 07 2000 - 00:57:48 CDT

Hello,

I've run into a bug when trying to compile vmd using redhat 7.0 (i386).

System
------
800MHz Athlon TBird (Abit KT7 mobo)
256M Atlas Precision RAM
Creative Labs 3D Blaster Annihilator 2 vid card (NVIDIA GeForce 2 GTS 32M DDR)
RedHat 7.0 (2.2.16-22 kernel)
XFree86 4.0.1
NVIDIA linux 0.9.5 drivers

Synopsis
--------
After downloading the precompiled vmd1.6a3 Linux DRI-OpenGL package, I
configured and installed it, but when I ran it, it immediately died after
very briefly popping up the console window. This seems to be a known problem
(http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/0093.html). I tried
fixing up the links to libGL.so like the mailing list email suggested, but
still it didn't work. So I downloaded the source and when I tried compiling
I got the following error message:

Converting AtomLexer.l --> AtomLexer.o ...
lex.yy.c:1659: declaration of `int isatty (int)' throws different
exceptions
/usr/include/unistd.h:670: than previous declaration `int isatty (int)
throw ()'
make: *** [AtomLexer.o] Error 1

After investigating this, I found the following (quick and dirty) workaround.
Modify line 670 in /usr/include/unistd.h:

<from>
extern int isatty (int __fd); __THROW;
<to>
extern int isatty (int __fd);

After I did this, vmd compiled smoothly and started up without any problems
after doing a "make install". Note that after compiling vmd, you should
undo the change to line 670 in unistd.h, as this is not a bug in unistd.h.

More Details
------------
Obviously the fix is a quick hack just to enable vmd to compile.

/usr/include/unistd.h is in the glibc-devel-2.1.92-14 package. It looks
like all the function prototypes in unistd.h now have "__THROW" appended
to them, which is something new in this file, different from the version in
the package found in RedHat 6.2 (glibc-devel-2.1.3-15). Furthermore, __THROW
is defined in /usr/include/malloc.h, and it resolves to "throw" only if you're
compiling C++ programs, which makes sense. VMD's Makefile first uses lex
to compile the AtomLexer.l file to lex.yy.c, renames lex.yy.c to lex.yy.C,
and then uses g++ to compile lex.yy.C. That looks like the source of the
problem, since the use of g++ causes __THROW to be "throw" instead of "" in
the prototype of isatty (line 670 /usr/include/unistd.h), which is different
than the C prototype of isatty in lex.yy.c (line 1659). I tried fixing
the Makefile to use gcc instead of g++ to compile lex.yy.c, but it looks like
AtomLexer.l includes Inform.h, which is a C++ header file (I guess that's
why you used g++ to compile it). So, if all this is accurate, it looks like
you need to fix AtomLexer.l to be able to be compiled using a C compiler,
not C++.

-John
jfduff_at_mtu.edu