[C++-sig] Link trouble on OS X
David Abrahams
david.abrahams at rcn.com
Thu May 30 15:05:49 CEST 2002
From: "Scott A. Smith" <ssmith at magnet.fsu.edu>
> Hi Dave,
>
> I had time to look at the Boost.Python build under OS X again.
> Recall that the build dies in the linking step, complaining about
> undefined symbols:
>
> > > /usr/bin/ld: Undefined symbols:
> > > _main
> > > _PyErr_SetObject
> > > _PyErr_SetString
> > > _PyExc_IndexError
> > > _PyExc_RuntimeError
> > > _PyExc_ValueError
> >
> > OK, it looks like OS X might be one of those platforms which requires
> > linking against the Python library. Try adding -lpython to the
> > command line
>
> That didn't work, but adding -lpython2.2 did remove this set. On the
> Mac I have (Python installed using Fink), things reside in
/sw/lib/python2.2
> and there is a library libpython2.2.a in the config sub-directory from
> there.
that sounds OK.
> > > _main
> > > ___builtin_delete
> > > ___builtin_new
> > > ___cp_push_exception
> > > ___eh_alloc
> > > ___pure_virtual
> > > ___rtti_si
> > > ___rtti_user
> > > ___throw
> > > ___vt_9exception
> >
> > These are functions in your compiler's runtime library. Have you got
> > multiple versions of GCC installed? In particular, have you got a
2.95.x
> > and a 3.x version installed? If so, you may not have properly supplied
> > GCC_ROOT_DIRECTORY to let the build system know how to find the
runtime.
>
> No, I am pretty sure that there is only a single GCC on the system. It is
> 2.95.2 (which they call 934.2 in the OS X port) and invoked with "cc" not
> "gcc". Similarly, g++ is invoked with c++. I had a look in /usr/lib and
> found that this is were libstdc++.a lives, so I set the variable
> GCC_ROOT_DIRECTORY to /usr. Unfortunately the above group of symbols are
> still undefined. Any ideas?
Hmm, if it's looking for _main, it seems as though it thinks you're trying
to build an executable. Are you using Boost.Build or are you trying to do
something else?
Also, are you building your own extension at this point, or just trying to
build bpl.so?
-Dave
More information about the Cplusplus-sig
mailing list