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

Scott A. Smith ssmith at magnet.fsu.edu
Thu May 30 16:07:48 CEST 2002


Hi again,

> 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?

I am just running bjam in the libs/python/build subdirectory, is that using
Boost.Build? What is Boost.Build, just the hierarchy of Jam files for Boost?

> Also, are you building your own extension at this point, or just trying to
> build bpl.so?

Just trying to build the Boost.Python library. This was
boost_python.(dll/lib)
on my PC with both Cygwin & MSVC++. Is this called bpl.so on Unix systems?
If so, then yes that is what I am trying to make.

Here is a recap:

1.) Max OS X, GCC 2.95.2, Python 2.2.1, Boost 1.28.0
2.) Build bjam.exe using plain "make", put it in my path
3.) Set PYTHON_ROOT and PYTHON_VERSION
4.) Ran bjam -sTOOLS=gcc -sBUILD=release in libs/python/build
5.) Hoped for the best

This made the object files fine but had trouble during the linking
step because there were may udefined symbols. At your suggestion
I ran that step by hand, adding in the python2.2 library explictly.
That cleared up some of the symbols, but not all. I then set the
GCC_ROOT_DIRECTORY variable hoping to get rid of more, but to no
avail.

Here is the full command and output, yuk.

=================================================================

export LD_LIBRARY_PATH
c++   -s -fPIC -shared  -o
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/r
untime-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"
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/r
untime-link-dynamic/shared-linkable-true/classes.o"
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/r
untime-link-dynamic/shared-linkable-true/conversions.o"
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/r
untime-link-dynamic/shared-linkable-true/extension_class.o"
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/r
untime-link-dynamic/shared-linkable-true/functions.o"
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/r
untime-link-dynamic/shared-linkable-true/init_function.o"
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/r
untime-link-dynamic/shared-linkable-true/module_builder.o"
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/r
untime-link-dynamic/shared-linkable-true/objects.o"
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/r
untime-link-dynamic/shared-linkable-true/cross_module.o"
"../../../libs/python/build/bin/libboost_python.so/gcc/release/inlining-on/r
untime-link-dynamic/shared-linkable-true/errors.o" -lpython2.2

/usr/bin/ld: Undefined symbols:
_main
___builtin_delete
___builtin_new
___cp_push_exception
___eh_alloc
___pure_virtual
___rtti_si
___rtti_user
___throw
___vt_9exception
_terminate__Fv
___cp_pop_exception
___rtti_func
___rtti_ptr
___start_cp_handler
___eh_rtime_match
___tf8bad_cast
___tfSc
___tfUc
___tfUi
___tfUl
___tfUs
___tfi
___tfs
___ti8bad_cast
___vt_8bad_cast
___eq__C9type_infoRCB0
___rtti_class
___tf9bad_alloc
___tf9exception
restFP
saveFP
___eprintf
___ti9exception

=================================================================

Note that the bjam command directly will also produce the problem
with _main (so it's less likely I goofed in copying the c++ command line).
Could this be a problem in the compilation/link flags set? I read that
they want users to insure that no pre-compiled headers are used and that
there is some special treatment of shared libraries, but since I don't
full comprehend the Boost.build process I am a bit leery to experiment.
Should I try messing with python.jam and/or gcc-tools.jam? Perhaps there
is just some problem is setting the appropriate directories to look,
although setting  GCC_ROOT_DIRECTORY expliclty didn't do any good.

Regards,
Scott


-----------------------------------------
-----------------------------------------

 Dr. Scott A. Smith
 Associate in Research
 National High Magnetic Field Laboratory
 1800 East Paul Dirac Drive
 Tallahassee, FL 32310

 phone: (850) 644-6348
 FAX:   (850) 644-1366
 email: ssmith at magnet.fsu.edu
 http://www.magnet.fsu.edu
 http://gamma.magnet.fsu.edu







More information about the Cplusplus-sig mailing list