[C++-sig] boost.python on OS X 10.3 (Panther)

Harri Hakula hhakula at math.hut.fi
Mon Nov 3 07:10:35 CET 2003

On Nov 3, 2003, at 3:05 AM, Ralf W. Grosse-Kunstleve wrote:

> --- Harri Hakula <Harri.Hakula at arabianranta.com> wrote:
>> With the latest compiler from Apple everything builds even on Jaguar.
>> I got most of the tests I tried running, but had to compile everything
>> manually.
> After seeing Harri Hakula's posting I've upgraded our Mac to
> OS 10.2.8 followed by installing the August 2003 gcc update.
> gcc --version reports:
> gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1493)
> I've used this gcc to compile Python 2.3 from scratch as a framework
> build. Using the current boost CVS I've made just one modification
> based on Sean Spicer's posting. See attached patch. Then:
> bjam -sPYTHON_VERSION=2.3 -sTOOLS=darwin "-sBUILD=debug <warnings>off"
> -sALL_LOCATE_TARGET=/net_coral/scratch1/rwgk/bjam
> This is a full success. Everything compiles and links without
> warnings or errors. Some tests run, but unfortunately most hang
> indefinitely until killed manually with -9. See attached log.
> For example, this is fine:
> bjam -sPYTHON_VERSION=2.3 -sTOOLS=darwin "-sBUILD=debug <warnings>off"
> -sALL_LOCATE_TARGET=/net_coral/scratch1/rwgk/bjam -sRUN_ALL_TESTS=1  
> dict
> ...found 2015 targets...
> ...updating 1 target...
> python-test-target
> /net_coral/scratch1/rwgk/bjam/bin/boost/libs/python/test/dict.test/ 
> darwin/debug/warnings-off/dict.test
> running...
> Done.
> ...updated 1 target...
> But this one hangs:
> bjam -sPYTHON_VERSION=2.3 -sTOOLS=darwin "-sBUILD=debug <warnings>off"
> -sALL_LOCATE_TARGET=/net_coral/scratch1/rwgk/bjam -sRUN_ALL_TESTS=1  
> list
> It hangs at this line:
> from list_ext import *
> According to the debugger the process hangs here:
> (gdb) where
> #0  0x90034728 in semaphore_wait_trap ()
> #1  0x90009c18 in pthread_mutex_lock ()
> #2  0x0054f1f0 in std::__default_alloc_template<true,  
> 0>::allocate(unsigned
> long
> etc.
> Does this ring any bells?
> Harri, how did you get around this problem? Could you please post more
> details about your platform and the commands that you used to compile
> and link?
Unfortunately I've already upgraded to Panther on my system so I cannot  
everything. (And I accidentally wiped my /usr/local/src ... :-()

Luckily, I did save some notes.

Mac: Dual 1GHz, 10.2.8
Apple compilers: August 2003 gcc update
MacPython 2.3 compiled from source with
./configure --enable-framework --with-cxx=g++
boost: I am not sure about this, but I believe it was 1.30.2 and not a  
snapshot from CVS.

I compiled with the standard actions except I added the -fabi-version=0  
since the ublas tests
require this -- I had this on MacPython also.

I followed Jonathan Brandmeyer's advice on an earlier thread and linked  
everything manually
along the lines of this makefile snippet (this is from his posting):
libboost_python.dylib: $(BOOST_OBJS)
	ld -w -d -u -o libboost_python.lo $^
	g++ -w -dynamic -undefined suppress -o $@ libboost_python.lo
	rm -f libboost_python.lo

I never got the dynamic loading working properly (unfortunately I did  
not save the error messages) but this led to success:
g++ -undefined suppress -flat_namespace -bundle getting_started1.o  
darwin/debug/shared-linkable-true/warnings-off/libboost_python.lo -o  

I am afraid I was not employing any scientific method while trying to  
get this to work.
Having reread Jonathan Brandmeyer's message I don't understand why I  
never tried
this idea
# python points to the python2.3 executable
# libboost_python.dylib is assumed to be on the standard library search
# path.
myextension.so: $(MYEXTENSION_OBJS)
	g++ -w -bundle -bundle_loader $(python) -o $@ $^ -lboost_python

Sorry for this stream-of-consciousness, too much teaching, not enough  


	Harri Hakula

More information about the Cplusplus-sig mailing list