[C++-sig] Building boost.python with non-framework python on MacOS X?
Jonathan Brandmeyer
jbrandmeyer at earthlink.net
Mon May 31 21:31:00 CEST 2004
On Mon, 2004-05-31 at 14:03, Nick Bastin wrote:
> Is it possible to build boost.python with a non-framework python
> (standard unix install) on MacOS X?
Yes. I use Boost.Python with the fink-supplied Python. The catch is
that I don't use bjam to do it. Also, I use a gcc compiled from FSF
sources rather than the Developer Tools/XCode. The last time I checked
(last fall), Apple's GCC was broken in such a way that an extension
would deadlock when it was imported into Python[1]. This bug (and the
one mentioned in the FAQ) could be fixed by now, I haven't checked.
I've attached the makefile that I use to build Boost.Python. The flags
are based on observing bjam's output on another platform. The final
link line is based on a discussion on this mailing list from several
months ago. Searching the archives for "OS X" should find it.
HTH,
Jonathan Brandmeyer
[1]: Has anyone else suffered from this before? The last few lines of
the backtrace look like this:
#0 0x90034728 in semaphore_wait_trap ()
#1 0x90009c18 in pthread_mutex_lock ()
#2 0x00c8cfb8 in std::__default_alloc_template<true,
0>::allocate(unsigned long) ()
#3 0x00c81380 in boost::python::converter::(anonymous
namespace)::entries() ()
#4 0x00c81418 in boost::python::converter::(anonymous
namespace)::get(boost::python::type_info) ()
#5 0x00cc175c in __static_initialization_and_destruction_0(int, int) ()
#6 0x8fe16350 in __dyld_call_module_initializers_for_library ()
#7 0x8fe160e4 in __dyld_call_module_initializers ()
#8 0x8fe106f0 in __dyld_link_in_need_modules ()
#9 0x8fe1016c in __dyld_bind_lazy_symbol_reference ()
#10 0x8fe00ec0 in __dyld_stub_binding_helper_interface ()
-------------- next part --------------
SHELL = /bin/sh
CXX = /usr/local/bin/g++-3.3
VPATH = $(srcdir) $(srcdir)/converter $(srcdir)/detail $(srcdir)/object
.DEFAULT = all
boostroot = ../boost_1_31_0
srcdir = $(boostroot)/libs/python/src
boostincdir = $(boostroot)
WARNINGFLAGS =
OPTIMIZEFLAGS = -DNDEBUG -O3
BOOSTFLAGS = -DBOOST_PYTHON_MAX_BASES=2 -DBOOST_PYTHON_SOURCE -DBOOST_PYTHON_DYNAMIC_LIB
OBJS = aix_init_module.lo dict.lo errors.lo list.lo long.lo module.lo \
numeric.lo object_operators.lo object_protocol.lo str.lo tuple.lo \
arg_to_python_base.lo from_python.lo registry.lo \
type_id.lo class.lo enum.lo function.lo inheritance.lo iterator.lo \
life_support.lo pickle_support.lo builtin_converters.lo
pythonroot = /sw
pythonincdir = $(pythonroot)/include/python2.2
DEPS = $(subst .lo,.d, $(OBJS))
%.lo: %.cpp
$(CXX) -ftemplate-depth-120 -fPIC $(WARNINGFLAGS) $(OPTIMIZEFLAGS) $(BOOSTFLAGS) -I$(pythonincdir) -I$(boostincdir) -c -o $@ $<
%.d: %.cpp
$(CXX) $(BOOSTFLAGS) -I$(pythonincdir) -I$(boostincdir) -MM -MF $@ -MT "$*.lo $@" $<
DYLIB_FLAGS = -v -dynamiclib -undefined suppress -flat_namespace -compatibility_version 1.31.0 \
-current_version 1.31.0
libboost_python.dylib: $(OBJS)
ld -dynamic -m -r -d -o libboost_python.lo $^
$(CXX) $(DYLIB_FLAGS) -o $@ libboost_python.lo
rm -f libboost_python.lo
libboost_python.a: $(OBJS)
ar rs $@ $^
all: libboost_python.dylib libboost_python.a
-include $(DEPS)
More information about the Cplusplus-sig
mailing list