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

Lenna Peterson arklenna at gmail.com
Sat Mar 31 16:48:14 EDT 2012


On Thu, Mar 29, 2012 at 10:05 AM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> 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



Peter,

re: Windows, I have some experience with mingw but none at all with
MSVC. I haven't yet figured out how to build python C modules on
Windows.

unistd.h is a POSIX header, so an acceptable short-term solution would
be to use io.h for MSVC. If test_MMCIF.py passes on Windows with io.h,
the C module is doing what we need it to do.

However, I'm leery of further manual modifications to generated C. The
lex.yy.c generated on Debian by flex 2.5.35 doesn't include unistd.h,
so might work with MSVC. I reverted to the 2003 lex.yy.c in large part
to make the diff less messy.

Furthermore, I plan to experiment with flex on Windows. I suspect that
lex.yy.c generated by Windows flex is more likely to compile on POSIX
than the converse.

I'll have time to come back to this next weekend; I'm currently
working on my GSoC proposal!

Lenna


More information about the Biopython-dev mailing list