[C++-sig] Link trouble on OS X

David Abrahams david.abrahams at rcn.com
Thu May 23 18:04:52 CEST 2002


----- Original Message -----
From: "Scott A. Smith" <ssmith at magnet.fsu.edu>
To: <c++-sig at python.org>
Sent: Thursday, May 23, 2002 11:27 AM
Subject: RE: [C++-sig] Link trouble on OS X


> Hi Dave,
>
> I've clipped out the CygWin stuff and rewrite with a different Subject
> when I have time to reattempt the build.
>
> > You can look at tools/build/python.jam if you can understand it.
However,
> > if you want me to help what I need from you is information about a link
> > command-line that works. For that, you can just do experiments by hand
> > until you find something that works.
>
> OK. Here is the exact output from jam when I do the build.
>
>     export LD_LIBRARY_PATH
>     c++   -s -fPIC -shared  -o
>
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/
r
>
ntime-link-dynamic/shared-linkable-true/libboost_python.so"  -L/sw/lib/pyth
<snip many lines>
> untime-link-dynamic/shared-linkable-true/errors.o"    -lutil
>
>
> /usr/bin/ld: can't locate file for: -lutil
>
> I looked around for any util library but cannot find it. I also just
tried a
> simpler version
>
> export LD_LIBRARY_PATH
>
> c++   -s -fPIC -shared  -o
>
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/
r
>
ntime-link-dynamic/shared-linkable-true/libboost_python.so"  -L/sw/lib/pyth
> on2.2/config
>
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/
r
> untime-link-dynamic/shared-linkable-true/types.o"

I hope that's not the whole thing, you've left out most of the neccessary
.o files! You also left out the -L option which allows it to find the
Python library.


> but this left me with complaints that it could not find anything. Here is
> the output from that.
>
> /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

> ___Q35boost6python6stringPCc
> ___apl__Q35boost6python6stringRCB0

This is due to the fact that you left out some of the .o files, I'm pretty
sure

> ___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.


> _get__CQ35boost6python6object
>
_handle_exception_impl__Q25boost6pythonGQ25boostt9function04ZvZQ25boost21em
p
>
ty_function_policyZQ25boost20empty_function_mixinZt9allocator1ZQ25boost13fu
n
> ction_base

More boost.python symbols probably due to missing .o files.

> _terminate__Fv
> ___eprintf
> ___tf9exception
> ___ti9exception

More missing symbols from the compiler's runtime.

> If you can give me some clues as to what I should add in to the
compilation
> command or what
> should be set for LD_LIBRARY_PATH

Don't worry about LD_LIBRARY_PATH; you don't need it for this part of the
build.

> I'll be happy to give it and variants a
> try. In the meantime
> I will look around for any known problems with OS X and builds of shared
> libraries.

HTH,
Dave






More information about the Cplusplus-sig mailing list