
This was a bug in boost.build (in python.jam). The following changes need to be made to python.jam: 853,854c849 < < if $(framework-directory) = Python.framework ---
if $(framework-directory:D=) = Python.framework
855a851
fwk = $(framework-directory) ;
905c899 < if $(framework-directory) ---
if $(fwk)
On 15/08/2008, at 4:52 PM, David Philp wrote:
I am trying to write a python extension for the Python that comes with Sage (Sage bundles its own Python). My user-config.jam is supposed to direct bjam to the Sage version of Python, but whatever I do, it links to the System Python.
I think my configuration is correct, because if I (as root) move the System Python.framework so that bjam cannot find it, I can compile a working extension. ("Working" in the sense that it can be loaded into Sage's python, and runs perfectly.)
Otherwise (without hiding System Python), the extension compiles just fine, but cannot be loaded into the Sage version of python. When loaded into Sage's python, it fails with "Fatal Python error: Interpreter not initialized (version mismatch?)" which seems reasonable. The extension can be loaded into the System Python.
Here are the details. I've used "Sage_root" for the base directory of Sage to make this a bit more readable. (It is actually /Users/ dphilp/sage-3.0.3.): boost 1.35.0 sage 3.0.3, which contains python 2.5.2p2 (slightly patched for sage, and is built using --enable-framework=Sage_root/local/Frameworks/Python.framework ) Everything seems to work fine, Sage's doctests run perfectly, etc.
In user-config.jam (this is overkill, but I wanted to remove any possible ambiguity): using python : 2.5 : Sage_root/local/Frameworks/Python.framework/Versions/2.5/bin/python : Sage_root/local/Frameworks/Python.framework/Versions/2.5/include/ python2.5 : Sage_root/local/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/config ;
bjam --debug-configuration reports that it is using the requested version of python, i.e. the one inside Sage.
Using --with-python=... on the command line does not help.
When I use --debug-building, there is no hint of the System Python.framework anywhere. But when I run otool -L my_ext.so, it reports that the extension is linked to the System framework---that is, unless I hide the System framework, in which case it reports that it is linked to the Sage framework.
This seems to me to be a bug in bjam, but I would appreciate any help either way. (Moving the System's python doesn't seem to be a good long term solution!)
Thanks in advance for any answers or redirections.
David
================================== David J Philp Postdoctoral Fellow National Centre for Epidemiology and Population Health Building 62, cnr Mills Rd & Eggleston Rd The Australian National University Canberra ACT 0200 Australia
T: +61 2 6125 8260 F: +61 2 6125 0740 M: 0423 535 397 W: http://nceph.anu.edu.au/
CRICOS Provider #00120C
================================== David J Philp Postdoctoral Fellow National Centre for Epidemiology and Population Health Building 62, cnr Mills Rd & Eggleston Rd The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 8260 F: +61 2 6125 0740 M: 0423 535 397 W: http://nceph.anu.edu.au/ CRICOS Provider #00120C