From: Andrew Jewett (jewett.ai_at_gmail.com)
Date: Mon Jan 10 2011 - 19:56:23 CST

Instructions for compiling VMD 1.8.7 on ubuntu 10.10.
I wrote this in November (and forgot to post it).
It's not perfect, but it works.
If I don't post it now, I will forget again.
Please also excuse the introductory tone.
(I was aiming this at readers like myself.)

This guide is an updated version of a guide original written by Kristina Wanous.
(http://debianclusters.org/index.php/NAMD:_Building_vmd)

    Other References:
http://www.ks.uiuc.edu/Research/vmd/doxygen/compiling.html
http://www.ks.uiuc.edu/Research/vmd/plugins/doxygen/
http://www.ks.uiuc.edu/Research/vmd/doxygen/cvsget.html

In these instructions, I assume that the VMD binary will be installed
in /usr/local/bin/vmd, and that "plugins" will be installed in
/usr/local/lib/vmd/plugins, and that the user has administrator
privileges. (As such, some of the steps require using "sudo". To
install in a user directory without privileges, then you can omit
"sudo" from the beginning of these commands.)

  --- Instructions for building VMD ---

1) If you don't already have the source code for BOTH "vmd" and
"plugins" (distributed separately), then retrieve it using CVS. This
is explained in more detail at:
http://www.ks.uiuc.edu/Research/vmd/doxygen/cvsget.html
Summary:
a) Request a cvs password at:
http://www.ks.uiuc.edu/Research/vmd/cvsrequest.html
b) alias vmdcvs 'cvs -d :pserver:username_at_cvs.ks.uiuc.edu:/vmd/cvsroot'
   where "username" is the name you requested.
c) vmdcvs login (enter your password)
d) vmdcvs checkout vmd
e) vmdcvs checkout plugins
f) vmdcvs checkout vmdbench
g) vmdcvs logout

2) Things seemed to run more smoothly if I moved the "plugins"
directory that I retrieved into the "vmd" directory.

  mv plugins vmd/

(This is not required. Alternatively, you can create a symbolic link
in your vmd directory to point to wherever you happen to have put your
"plugins", if it's not in the vmd directory.)

3)
Install the development libraries that vmd depends on.
This is an incomplete, and it only works if you want to
install a version of VMD with the minimum set of features.
  sudo apt-get install tcsh
  sudo apt-get install tcl tcl-dev tcl8.5-dev
  sudo apt-get install tk tk-dev tk8.5-dev
  sudo apt-get install fltk libfltk1.1 lbfltk1.1-dev
  sudo apt-get install libnetcdf-dev
  sudo apt-get install libg1-mesa libg1-mesa-dev
  sudo apt-get install libglu1-mesa libglu1-mesa-dev
  sudo apt-get install tachyon libtachyon-dev
For me running ubuntu 10.10, these packages seemed to be enough.
(I wasn't running on a fresh installation of ubuntu at the time, so
this list might be incomplete.)

----compile the "plugins" directory src tree:----

4) If you don't use csh or tcsh (probably not if you have been using
vanilla ubuntu), then start the tcsh shell:

  tcsh

5)

  setenv TCLINC -I/usr/include/tcl
  setenv TCLLIB -F/usr/lib/

(Since we will define these variables later when invoking make below,
this step was probably unnecessary. However I was paranoid, so I
defined them anyway.)

6) cd /to/your/work/area/plugins/
(In my case: cd ~/code/vmd_cvs/vmd/plugins/)

(COMMENT:
Some guides tell you to define the "PLUGINDIR" environment variable
(for example "setenv PLUGINDIR /usr/local/lib/vmd/plugins"). If I
understand correctly, environment variables are forgotten when you use
sudo. So this won't work unless you don't need administrator
privileges. Instead, we will will define PLUGINDIR when we invoke
"make" in step 9 below.)

7)

There are many steps below which depend on what kind of libraries you
are using (32 bit or 64 bit). In the steps below, I'll ask you to
define a variable (OSARCH) which is set to either LINUXAMD64 or LINUX
(or something else). I'm using the 64-bit version of ubuntu, so I
use:

  setenv OSARCH LINUXAMD64

I don't know, but I suspect that on a a 32-bit OS and compiler, you
might instead need to use:

  setenv OSARCH LINUX

8)

  make clean
  make $OSARCH TCLINC=-I/usr/include/tcl TCLLIB=-F/usr/lib/

9)
  sudo make distrib PLUGINDIR=/usr/local/lib/vmd/plugins

(Again, you can omit "sudo" at the beginning of this command if
"PLUGINDIR" points to user's directory, instead of somewhere inside
/usr/local/)

----compile vmd:----

10)
  cd to the outermost directory that contains your vmd code.
(Assuming that you plugins directory is inside this directory) you can
use:

  cd ../

11) optional:
Change the target directory by editing the "configure" script and
changing these lines at the beginning of the file:

$install_name = "vmd";
$install_bin_dir="/usr/local/bin"
$install_library_dir="/usr/local/lib/$install_name";

(I was happy with the default locations (in /usr/local), so I did not
make any modifications to the "configure" script.)

13)

Choose the options for configure and run configure.
The minimal set of options is presently:

   ./configure $OSARCH OPENGL FLTK TK IMD SILENT TCL PTHREADS

... and this is what I used.
(This creates a spartan version of VMD. Using a longer list of
configure options would require installing more packages during step
3 above. I did not attempt this. Good luck.)

----------------------------------------
Alternately, you can use the "make" command, along with a target in
the Makefile. For example, you can use.

   make linux.opengl
or
   make linux.amd64.opengl
or
   make linux.amd64.mpi
or
   make linux.cuda.opengl)

Incidentally "make linux.amd64.opengl" is equivalent to running:
   ./configure $OSARCH OPENGL FLTK TK IMD VRPN SILENT LIBSBALL XINPUT
TCL PTHREADS ACTC LIBTACHYON NETCDF PYTHON NUMPY CUDA XINERAMA

..however, these extra options installed additional features that made
it more difficult to compile and link VMD (requiring additional
libraries). I did not feel like resolving these issues, and I was
content to get VMD to work at a basic level.
----------------------------------------

14)

  cd src

15)
  make veryclean

16) Run "make" without any targets (sort of)

   make

Compilation will proceed for a while, eventually halting with this
error message:

PluginMgr.C:34: fatal error: libmolfile_plugin.h: No such file or directory
There is a problem with the INCDIRS variable inside the makefile. It should be:
INCDIRS = -I. -I../plugins/include
-I/usr/local/lib/vmd/plugins/$OSARCH/molfile/ -I/usr/include/tcl

You can fix it (without editing the Makefile) using this command:

   make INCDIRS="-I. -I../plugins/include
-I/usr/local/lib/vmd/plugins/$OSARCH/molfile/ -I/usr/include/tcl"

Compilation will continue until the following error message:
/usr/bin/ld: cannot find -lmolfile_plugin

To get around this error, the "LIBS" variable in the makefile needs to
be changed. If you don't want to edit the Makefile, then use this
command:

   make LIBS="-lm -ltcl -lfltk -lGL -lGLU -ltk8.4 -ltcl8.4
/usr/local/lib/vmd/plugins/$OSARCH/molfile/libmolfile_plugin.a"

(Note: If you compiled the plugins using "make
PLUGINDIR=/usr/local/lib/vmd/plugins", as we did above, then this
libmolfile_plugin.a file should be located in that directory. If you
installed the plugins somewhere else, then you must change the LIBS
variable accordingly.)

If everything compiled successfully, you should see the following message:

"No resource compiler required on this platform."

So far, so good.

17) Now run:

  sudo make install

(Again, you can omit "sudo" at the beginning if $install_bin_dir and
$install_library_dir are located in a user's private directory.)

There is a 20-second long pause, and it prints out some discouraging
error messages:

"tar: Exiting with failure status due to previous errors
Make sure /usr/local/bin/vmd is in your path.
VMD installation complete. Enjoy!"

In spite of this, VMD should be compiled and working. You can launch it using:

/usr/local/bin/vmd

(At the risk of sounding redundant, I note that that the VMD menus in
ubuntu 10.10 may seem broken when you click on them, but they do work.
 If the menus seem unresponsive, try pulling down after clicking on
them.)