I'm working on the same thing, without getting to a working pymol
yet though.  Here's what I've done so far:

1.  installed mingw and msys, also 4.2.1 gcc
2.  made  /mingw/bin/gcc.exe the 4.2.1 gcc
3.  built and installed zlib, using 
    ./configure --prefix=/mingw
4.  built and installed pnglib, using
    ./configure --prefix=/mingw
5.  Obtained the current branch of pymol on a linux system with
    subversion with:

    svn co \
    https://pymol.svn.sourceforge.net/svnroot/pymol/branches/b10 \
    pymol

    made a .tar.gz and transferred it to the mingw environment.
6.  cd pymol*
7.  modified setup.py.  It thinks this is a "win32" system, which is a
problem, since it keeps making Visual C specific assumptions even when
"-c mingw32" is used.  Anyway, changed the win32 section of setup.py
to this:

if sys.platform=='win32':
   inc_dirs=["ov/src",
             "layer0","layer1","layer2",
             "layer3","layer4","layer5",
             "others"]
   libs=["opengl32","glu32","png","z"]
   pyogl_libs = ["opengl32","glu32"]
   lib_dirs=["/mingw/lib"]
   def_macros=[("_PYMOL_MODULE",None),
                  ("WIN32",None),
                  ("_HAVE_LIBPNG",None),
                  ("_STDCALL_SUPPORTED",None),
                  ("_M_IX86",None)
               ]
   ext_comp_args=[]
   ext_link_args=["glut32.lib"]

8. Removed the include of winappc.h from layer1/P.c.  That is
a VisualC++ include.  Since we aren't using VisualC, the include is
not needed.
9. Put glut.h in /pymol/others/GL/glut.h
10. put glut32.lib and glut32.dll in /pymol.
(Note, see:  http://www.mingw.org/MinGWiki/index.php/Glut
I have a positive control with the pulsar.c program that this glut
works within mingw to produce programs capable of showing stereo, ie

 gcc -D_STDCALL_SUPPORTED -D_M_IX86 -I.  -o pulsar.exe  pulsar.c
glut32.lib -lopengl32 -lglu32

where pulsar.c is from

http://local.wasp.uwa.edu.au/~pbourke/projection/stereorender/pulsar.c

)

11. export PATH=$PATH:/c/progs/python25
(wherever you have python installed.  This is the WINDOWS version
of python that installs with an .msi, from www.python.org).  Your
path will probably differ.  

12.  Create a pydistutils.cfg, otherwise the "install" step won't
work, as Python was built with VisualC++ and install won't
accept a "-c mingw32" modifier:

cd ~
cat >pydistutils.cfg <<EOD
[build]
compiler=mingw32
EOD


13.  Now in an MSYS window try to build:

  cd pymol*
  python setup.py build 2>xpbuild_stderr_step1_phase1.log  | tee
xpbuild_step1_phase1.log

which will run along fine until it tries to build _glut.pyd.  The
problem is that it needs to include glut32.def but the Python build
mechanism doesn't recognize this as a link step, so it ignores the
ext_link_args value in setup.py.  I could not find a workaround.  So
I opened a DOS window, changed directory to the top of pymol, cut the
command from the MSYS window, pasted it into the DOS window, added
 glut32.def
on the end, and ran it.  As expected, it completed correctly.  Then
resumed building with:

  python setup.py build 2>xpbuild_stderr_step1_phase2.log  | tee
xpbuild_step1_phase2.log

and it went to the end.  There are a LOT of warnings in there though.
Most involve ignored pragmas and variables declared but not used in
glut.h, such as:

xpbuild_stderr_step1_phase1_try1.log:others/GL/glut.h:503: warning:
'glutCreateWindow_ATEXIT_HACK' defined but not used

However, there were 33 uninitialized variable warnings, and some
incompatible pointer types.  I'll have to look at those regions of the
code.


14.  Next do the installation steps:

  python setup.py install 2>xpbuild_stderr_step2.log  | tee
xpbuild_step2.log
  python setup2.py build 2>xpbuild_stderr_step3.log  | tee xpbuild_step3.log

And voila!  A nonworking pymol :-(

Double clicking on pymol.bat resulted in a 

"This application has failed to start because libpng-3.dll
was not found."

Well libpng-3.dll was in /mingw/bin, so it was copied to 
/c/progs/python25/DLLs
and
/mingw/lib

Neither of which helped.

Finally, it was copied to the same directory as pymol.bat. Now when
it starts (double click on pymol.bat) it comes up a bit farther.  It:

1. puts up the copyright notice, and gets down to the PyMol>_ prompt.
2. The rest of the first window (the right side, with what looks
like sound player control buttons along the bottom) comes up.  However
the Tcl/Tk GUI part never starts.  Python 2.5.1 definitely includes
both of those, and Pmw is installed.

I built the same version (rev 3028 from subversion) on linux and
it had many fewer warnings and of course ran without problems. 
It was the same version of Python on both platforms, but gcc 4.1.2
on Linux and 4.2.1-sjlj on Mingw.  I suspect platform specific changes
in types, as caught by the various warning messages noted above.

Anybody know a way to force pymol to run in a mode that will give 
some hint as to where this is going wrong?  How does one start
pymol up within Idle?

Thanks,

David Mathog
mat...@caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech


Reply via email to