|
Boost Users : |
From: doak87508 (jdoak_at_[hidden])
Date: 2002-02-27 18:36:19
--- In Boost-Users_at_y..., Tom Matelich <tmatelich_at_z...> wrote:
> The first getting_started1.so contains all the symbols from all of
> the objects linked into it. The second one only contains the
> symbols from getting_started.o and the symbols from
> libboost_python.a which satisfy unsatified symbols of
> getting_started1.o. Linking shared library is like linking an
> executable, it only takes the symbols from archives that it needs
> to satisfy itself.
>
> The first question is why you want libboost_python.a. If it is a
> valid reason, then you need to find a way to get all the code you
> need out of it into the shared lib. The first would be to use ar
> to get all the objects out, then take those and put them into the
> shared library. The second would be to keep adding unsatified
> symbols to getting_started.o until getting_started1.so has
> everything it needs.
It appears that my desire to link using an archive instead of the
individual object files may have been self-misguided. This was simply
my interpretation of the documentation in
http://www.boost.org/libs/python/doc/building.html. Indeed, after your
explanation above, I cannot come up with a reason why I would
need/want to use libboost_python.a. I'll just plow forward linking
with the individual objects as that works like a charm.
Thanks for the clarification.
JD
> Tom
>
> > -----Original Message-----
> > From: doak87508 [mailto:jdoak_at_l...]
> > Sent: Wednesday, February 27, 2002 10:21 AM
> > To: Boost-Users_at_y...
> > Subject: [Boost-Users] Linking an Archive
> >
> >
> > I am playing around with using an archive to created a shared
library
> > (.so file) instead of linking all the individual objects. I have
> > success when I link individual objects:
> >
> > % g++ -shared classes.o conversions.o errors.o extension_class.o
> > functions.o init_function.o module_builder.o objects.o types.o
> > cross_module.o getting_started1.o -o getting_started1.so
> >
> > % python
> > 1;31mh[1] >>> import getting_started1
> > 1;31mh[1] >>> getting_started1.greet()
> > 'hello, world'
> >
> > Now, I create an archive:
> >
> > % ar r libboost_python.a classes.o conversions.o errors.o
> > extension_class.o functions.o init_function.o module_builder.o
> > objects.o types.o cross_module.o
> >
> > Then, I link that archive into the shared library:
> >
> > % g++ -shared libboost_python.a getting_started1.o -o
> > getting_started1.so
> >
> > % python
> > 1;31mh[1] >>> import getting_started1.so
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > ImportError: ./getting_started1.so: undefined symbol:
> > add__Q35boost6python19module_builder_basePQ45boost
> > 6python6detail8functionPCc
> >
> > I have also tried linking as follows with no change in result:
> >
> > % g++ -shared -L. -lboost_python getting_started1.o -o
> > getting_started1.so
> >
> > Does someone know how to get linking working with an archive file?
> >
> > JD
> >
> >
> >
> > Info: <http://www.boost.org>
> > Wiki:
<http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> > Unsubscribe: <mailto:boost-users-unsubscribe_at_y...>
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net