[Biopython-dev] Re: Work towards getting KDTree compiling

Michiel Jan Laurens de Hoon mdehoon at ims.u-tokyo.ac.jp
Sat May 8 02:03:15 EDT 2004

Brad Chapman wrote:
> Brilliant. It seems simple enough and only requires us to specify
> the language as c++ for our included C++ code. +1 from me for keeping
> this in the setup.py.
> If people on disparate platforms could give this another test and
> let me know if anything breaks that would be great. Especially like
> to hear from the ol' Windows folks. For the record, it all works
> fine for me on a FreeBSD machine with gcc (but we probably already
> knew that :-).
I tried to compile the Biopython in CVS on various platforms to make sure 
everything works for the upcoming release.

Using Python 2.3.3:

o) On cygwin, the compilation runs fine.

o) On Windows, the compilation of KDTree fails:

building 'Bio.KDTree._CKDTree' extension
creating build\temp.win32-2.3\Release\bio\kdtree
C:\cygwin\bin\cc.exe -Ic:\Python23\include -Ic:\Python23\PC -c Bio/KDTree/KDTree
.swig.cpp -o build\temp.win32-2.3\Release\bio\kdtree\kdtree.swig.o
error: command 'cc' failed: Invalid argument

I am compiling with python setup.py build --compiler=mingw32. The C extensions 
in Biopython (e.g. Bio.Cluster) compile without problems.
This may be a bug in distutils for mingw32 when dealing with C++.

o) On SunOS 5.8, the compilation runs fine, using the native cc compiler for the 
C extensions and the g++ compiler for the C++ extensions. Note that mixing the 
cc compiler and the g++ compiler may lead to crashes. But at least on SunOS 5.8, 
no such problems occur when importing KDTree or Affy.

o) On Mac OS X, the compilation seems to run fine, but python crashes if one of 
the C++ modules is imported. The C modules do not cause a crash. I am not sure 
what causes this crash; the C and C++ compilers are consistent with each other.

I am not very familiar with C++ and I'm not sure what to solve this, so I'll 
limit myself to reporting problems :-).

By the way, there is a typing error in setup.py:


It seems that in the first line, that should be 'Bio.Affy._cel', otherwise _cel 
will end up in the wrong place.


Michiel de Hoon, Assistant Professor
University of Tokyo, Institute of Medical Science
Human Genome Center
4-6-1 Shirokane-dai, Minato-ku
Tokyo 108-8639

More information about the Biopython-dev mailing list