Friday, June 26, 2009

Success!

As of today, I have officially made a working SWIG representation of a Bio++ object. (And it's about bloody time.)

I was having some linking errors, so I spent some time today rereading SWIG docs (specifically the bits about Python). Turns out that the errors I was having were mentioned explicitly in them. When I linked together the .so file, I needed to make sure that all its dependencies were there.

So here's the commands I used:

$ swig -python -c++ -I../../../../contrib/biopp/utils/Utils/ Exceptions.i
$ g++ -c -fpic Exceptions.cpp
$ g++ -c -fpic TextTools.cpp
$ gcc -c -fpic Exceptions_wrap.cxx -I/usr/include/python2.6/
$ g++ -shared Exceptions.o Exceptions_wrap.o TextTools.o -o _bpp_exceptions.so

Exceptions depends on TextTools, hence the inclusion of that object file.

I'm not certain that -fpic is necessary--some of the SWIG docs indicate that this is only for some specific platforms, but not Linux. It certainly doesn't hurt things, though.

I think things will be easier if I can manage to put everything in utils into a single object file.

No comments:

Post a Comment