[C++-sig] Boost.Python to use non-standard python location on OS X

Jonathan Brandmeyer jbrandmeyer at earthlink.net
Sat Jul 29 22:11:31 CEST 2006


On Wed, 2006-07-26 at 15:17 -0700, Roberto Aguilar wrote:
> Hello,
> 
> I'm trying to build the example Boost.Python project on OS X using the
> python version 2.4.2 provided by Fink, which is installed at:
> 
> /sw/bin/python
> 
> The includes and libraries are:
> 
> /sw/include/python2.4
> /sw/lib/python2.4
> 
> I set the following in my Jamrules file:
> 
> PYTHON_VERSION = 2.4 ;
> PYTHON_ROOT = /sw ;
> PYTHON_INCLUDES = /sw/include/python2.4 ;
> PYTHON_LIB_PATH = /sw/lib/python2.4 ;
> 
> But, when I build, it seems that the resulting module is still linking
> to /usr/bin/python, which is version 2.3.
> 
> Trying to use the module using /sw/bin/python results in:

> ----
> [berto at drjekyll][713]$ /sw/bin/python
> Python 2.4.2 (#1, Mar 22 2006, 18:15:19)
> [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import data
> Fatal Python error: Interpreter not initialized (version mismatch?)
> Abort trap
> ----
> 
> But using /usr/bin/python, everything works well.
> 
> I then thought the problem was that I built boost without specifying
> the non-standard location so I recompiled using:
> 
> ----
> bjam -sTOOLS=darwin -sPYTHON_ROOT=/sw -sPYTHON_VERSION=2.4
> -sPYTHON_INCLUDES=/sw/include/python2.4
> -sPYTHON_LIB_PATH=/sw/lib/python2.4 -a
> ----

When you use -sTOOLS=darwin, Boost.Jam always links against
Python.framework, regardless of which PYTHON_ROOT and kin are selected.
IIRC, specifying -sTOOLS=gcc works fine when you want to link against
Fink's Python, but I don't have a Mac to test with right now.  I think
that there is a older Boost package in Fink, possibly in unstable.  So
you might see how they build their Boost package.

HTH,
-Jonathan




More information about the Cplusplus-sig mailing list