[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Link Python bindings against platform-specific library directory v4 (was: Re: [PATCH] Explicitly link the python bindings against libpython (was: Re: Major upgrades to SWIG/Python bindings in r15848))

From: David James <james82_at_gmail.com>
Date: 2005-08-28 23:19:29 CEST

On 8/28/05, Justin Erenkrantz <justin@erenkrantz.com> wrote:
> Yup, if we meet all of these scenarios with the same code, we'll be
> doin' good. =)
Hi Justin,

I've upgraded my patch to follow your advice. This patch should work
in all of our build scenarios now. Does this work for you?

[[[
Fix python library options when we have separate platform-specific
library directories, or when we are compiling on Mac OS X without a
framework.

* build/get-py-info.py:
 (string): Remove include.
 (ldshared_process): Remove function.
 (add_option): New function. Adds an option to a list of options.
 (add_option_if_missing): New function. Adds an option to a list of
 options, if it is not already present.
 (link_options): New function. Gets a list of the Python linker options.
 (lib_options): New function. Gets a list of the Python library options.
 (__main__): Use link_options and lib_options instead of ldshared_process.
]]

Thanks for your help!

David

> On Sun, Aug 28, 2005 at 02:02:04PM -0400, David James wrote:
> > On 8/28/05, Justin Erenkrantz <justin@erenkrantz.com> wrote:
> > > > Justin, does this patch work better?
> > >
> > > Nope. Here's some pointers as to what I'm getting and what's incorrect with
> > > each output with your patch. (Trunk emits correct output in each case for me.)
> > Thanks! This is very helpful. Before I write another patch, I'll have
> > to figure out what I'm supposed to be outputting on each platform.
> > I'll do this below. Let me know whether you think the proposed output
> > is good.
> >
> > > Mac OS X 10.4:
> > >
> > > % python ./build/get-py-info.py --link
> > > gcc -Wl,-F. -Wl,-F. -bundle -undefined dynamic_lookup
> > > -Wl,-F/System/Library/Frameworks -framework Python
> > > % python ./build/get-py-info.py --libs
> > > -Wl,-F. -Wl,-F. -bundle -Wl,-F/System/Library/Frameworks -framework
> > >
> > > We don't need -F/System/Library/Frameworks, but that's minor.
> > Currently, I add in a "-F" statement with the framework prefix. Is
> > this ever necessary?
>
> Only if it isn't /System/Library/Frameworks - it's like /usr/lib in the
> sense that it's in the 'default' lookup path.
>
> > Here's a few examples where the trunk code doesn't work. I'll show the
> > output of "get-py-info.py --libs" in each case.
> >
> > ---
> > Linux, architecture-dependent library directory, no DSO:
> > NOTE: Static library is stored in /pkgs/python-2.3.4/linux/lib/config
> > Trunk (doesn't work):
> > -L/pkgs/python-2.3.4/lib/python2.3/config -lpython2.3
> > Proposed output (works):
> > -L/pkgs/python-2.3.4/linux/lib/config -lpython2.3
> >
> > ---
> > Solaris, architecture-dependent library directory, no DSO:
> > NOTE: Static library is stored in /pkgs/python-2.3.4/sunos5/lib/python2.3/config
> > Trunk (I assume this doesn't work):
> > -L/cs/src/ddd-3.3.1/readline
> > -L/pkgs/python-2.3.4/lib/python2.3/config -lpython2.3
> > Proposed output (I assume this works):
> > -L/cs/src/ddd-3.3.1/readline
> > -L/pkgs/python-2.3.4/sunos5/lib/python2.3/config -lpython2.3
> >
> > ---
> > Mac OS X, no framework:
> >
> > Trunk (doesn't work, because there is no python2.2 library):
> > -L/usr/lib/python2.2/config -lpython2.2
> > Proposed output (works):
> > -bundle -flat_namespace -undefined suppress -bundle_loader /usr/bin/python
> >
> > ("-bundle -flat_namespace -undefined suppress" is unnecessary, but
> > these arguments are specified in the Python LDSHARED linker options
> > for Python 2.2, so I figure it's a good idea to leave them alone.)
>
> Yah, let's not try to second-guess what is in LDSHARED in the Makefile.
>
> > ---
> > Mac OS X 10.4:
> > NOTE: Framework prefix is /pkgs/python-2.3.4/framework
> > Trunk (This works, but it's missing the dynamic_lookup option):
> > -framework Python
> > Proposed output (Better?):
> > -Wl,-F. -Wl,-F. -bundle -undefined dynamic_lookup -framework Python
> >
> > ("-Wl,-F. -Wl,-F. -bundle -undefined dynamic_lookup" are specified by
> > the LDSHARED linker options, and I believe they allow for better
> > portability.)
>
> *nod*
>
> > ---
> > Linux, home dir install, no DSO:
> > NOTE: Static library is stored in /h/46/james/lib/python2.4/config
> > Trunk (works):
> > -L/h/46/james/lib/python2.4/config -lpython2.4
> > Proposed output: Same output.
> >
> > ---
> > Linux, full install, no DSO:
> > NOTE: Static library is stored in /usr/lib/python2.2/config
> > Trunk (works):
> > -L/usr/lib/python2.2/config -lpython2.2
> > Proposed output: Same output.
>

-- 
David James -- http://www.cs.toronto.edu/~james


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Sun Aug 28 23:20:18 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.