[Biopython-dev] [biopython] Fix flex library dependency of MMCIFlex; closes 2619 (#31)

Peter Cock p.j.a.cock at googlemail.com
Thu Mar 29 14:05:46 UTC 2012


Hi Lenna,

Have you tried your branch on Windows yet?

It worked for me under my Python 2.5 setup using mingw32,

C:\repositories\biopython>c:\python26\python setup.py install
...
building 'Bio.PDB.mmCIF.MMCIFlex' extension
creating build\temp.win32-2.5\Release\bio\pdb
creating build\temp.win32-2.5\Release\bio\pdb\mmcif
C:\cygwin\usr\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IBio
-Ic:\python25\include -Ic:\python25\PC -c Bio/PDB/mmCIF/lex.yy.c -o
build\temp.win32-2.5\Release\bio\pdb\mmcif\lex.yy.o
lex.yy.c:1046: warning: 'yyunput' defined but not used
C:\cygwin\usr\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IBio
-Ic:\python25\include -Ic:\python25\PC -c
Bio/PDB/mmCIF/MMCIFlexmodule.c -o
build\temp.win32-2.5\Release\bio\pdb\mmcif\mmciflexmodule.o
writing build\temp.win32-2.5\Release\bio\pdb\mmcif\MMCIFlex.def
C:\cygwin\usr\bin\gcc.exe -mno-cygwin -shared -s
build\temp.win32-2.5\Release\bio\pdb\mmcif\lex.yy.o
build\temp.win32-2.5\Release\bio\pdb\mmcif\mmciflexmodule.o
build\temp.win32-2.5\Release\bio\pdb\mmcif\MMCIFlex.def
-Lc:\python25\libs -Lc:\python25\PCBuild -lpython25 -lmsvcr71 -o
build\lib.win32-2.5\Bio\PDB\mmCIF\MMCIFlex.pyd
...

That worked fine and test_MMCIF.py is happy. However, MSVC v9 is not:

C:\repositories\biopython>c:\python26\python setup.py install
...
building 'Bio.PDB.mmCIF.MMCIFlex' extension
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo
/Ox /MD /W3 /GS- /DNDEBUG -IBio -Ic:\python26\include -Ic:\python26\PC
/TcBio/PDB/mmCIF/lex.yy.c
/Fobuild\temp.win32-2.6\Release\Bio/PDB/mmCIF/lex.yy.obj
lex.yy.c
Bio/PDB/mmCIF/lex.yy.c(12) : fatal error C1083: Cannot open include
file: 'unistd.h': No such file or directory
error: command '"C:\Program Files\Microsoft Visual Studio
9.0\VC\BIN\cl.exe"' failed with exit status 2

The same with Python 2.7 and the Microsoft compiler. Switching
from this in Bio/PDB/mmCIF.yy.c:

#include <unistd.h>

to this:

#include <io.h>

lets it compile (although with some warnings) and test_MMCIF.py passes.
If should be conditional of course, but I'm unclear if that is the appropriate
fix or not though.

Peter



More information about the Biopython-dev mailing list