Building Python as a shared lib plugin.

Ignacio Vazquez-Abrams ignacio at openservices.net
Tue Aug 28 17:43:17 EDT 2001


On Tue, 28 Aug 2001, Chachkoff Yann wrote:

> Le Mardi 28 Août 2001 16:16, vous avez écrit :
> > Section 5.2 of the Extending and Embedding the Python Interpreter says:
> >
> <snip>
> >
> > The '-Xlinker' tells gcc to pass '-export-dynamic' to ld. gcc itself seems
> > to ignore it otherwise.
>
> I of course tried this first (I always read manuals before working). It does
> not work. I tried the following one:
>
> $(CC) $(FLAGS) -shared -Wl,-soname,plugin_python.so.0 $(OBJECTS)
> ../common/libcross.a -Xlinker -export-dynamic
> /usr/lib/python2.0/config/libpython2.0.a -lpthread -lutil -ldmalloc -o
> plugin_python.so.0.1
>
> Maybe I'm completely wrong or simply dumb. But I passed the correct options
> to gcc and it simply does not solve the problem. (Thanx for trying to help
> anyway)
>
> Chachkoff Y.

Sorry, in tests that I did gcc silently ignored '-export-dynamic' when passed
to it, so I thought that that might have been the problem.

OTOH...

>From the ld man page:

"
       --whole-archive
              For each archive mentioned on the command line  af­
              ter  the  --whole-archive option, include every ob­
              ject file in the archive in the link,  rather  than
              searching  the  archive  for  the  required  object
              files.  This is normally used to  turn  an  archive
              file into a shared library, forcing every object to
              be included in the resulting shared library.
"

If I understand correctly, you may need to add '-Xlinker --whole-archive'
before python2.0.a.

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>





More information about the Python-list mailing list