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

Brad Chapman chapmanb at uga.edu
Sat May 8 13:35:04 EDT 2004

Hi Michiel;

> I tried to compile the Biopython in CVS on various platforms to make sure 
> everything works for the upcoming release.

Sweet. Thanks for doing this -- it will really help to have this
widely tested before the release.

> 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++.

Yeah, I don't really understand the error (Invalid argument seems to
imply there is something wrong with the commandline, and I'm not
sure what that is), but digging through distutils code it looks like
C++ in mingw32 is not really supported.

As a complete guess, I tried applying the same changes I used for
Python 2.2.x to mingw32 compilation. Will you give the new setup.py 
a try and see if it improves anything at all?

> 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.

Does Tests/test_KDTree.py work for you as well? If there are no
problems then I say we are all in the clear. Since distutils is
really just pulling up the C++ compiler information from the
environment, there is really nothing we can do about the cc/g++
conflict -- honestly this is probably a issue where a solaris user
has to set CXX to point to the native c++ compiler.

> 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.

Hmmm. How do they crash? Just a core dump? Can you attach gdb and
see anything? Also, is this with gcc? What versions? For the record,
I'm compiling with gcc version 2.95.4 and 3.3.3 without any

Can any other Mac OS people confirm this problem? Any solutions from

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

Okay :-). Seriously, this is great -- I don't have access to a lot
of systems right now so this is the only way we can really make sure
the messy compilation will work across platforms.

> 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.

Whoops. Thanks. Fixed.

Thanks again for the report.

More information about the Biopython-dev mailing list