I am working on compiling a python extension (specifically 
libtorrent-rasterbar), and would like to wind up with a single executable that 
I can use on multiple versions of MacOS X (specifically 10.5 and 10.6) without 
having to force the version of python used on each version (10.5 has 2.5, 10.6 
has 2.5 and 2.6, but defaults to 2.6). When I compile using bjam:

bjam debug-symbols=on dht-support=on boost=source architecture=combined 
toolset=darwin address-model=32_64

(with BOOST_BUILD and BOOST_ROOT set approrpiatly)

        I get a working binary (libtorrent.so) that works great on the platform 
I am working on, and is a "Universal binary" (ppc/ppc64/i386/x86_64), but when 
I try to "import" it on the other platform without specifying the version of 
python I get:

Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap

        Forcing the version of python (so forcing 10.6 to use 2.5) allows the 
module to be imported and used without problem.

        After an evening of searching around on mailing lists I almost came to 
the conclusion that it is not possible to compile python modules that work with 
multiple versions of python... except that I have built a version of the MySQL 
module that does exactly that. It runs without complaint on 10.5 (ppc and 
intel), and 10.6 (intel only), on both python 2.5 and 2.6.

        So my questions:

1) Is this a limitation of Boost.Python? A trick from MySQL that I can emulate? 
Am I missing something obvious? I have tried a large number of variations in 
build commands using combinations of the following:

link=shared --layout=versioned --enable-framework --build-type=complete 
link=shared,static macosx-version=10.5 macosx-version-min=10.5

2) If this is not a possibility with Boost.Python-built modules, what would be 
the best work-around. I can probably build separate modules with the target 
python version in their names, and play games with importing them. But that is 
obviously a less-desired version of things, since it would require: a) multiple 
60Meg binaries, and b) having 2 at the moment, and presumably a third when 10.7 
ships.

        Note: I am using Boost 1.46.1 and libtorrent-rasterbar 0.15.6, the 
latest releases of both as of a couple of days ago.
--
        Karl Kuehn
                lark...@softhome.net




_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to