[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 v3 (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 20:02:04 CEST

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?

> The big problem is that --libs doesn't have '-framework Python'
Oops. I'll fix this in my next patch.

> Solaris 10:
>
> % python get-py-info.py --link
> cc -G -L/pkg/python-2.4/lib -L/pkg/python-2.4/lib/python2.4/config -lpython2.4
> % python get-py-info.py --libs
> -L/pkg/python-2.4/lib -L/pkg/python-2.4/lib/python2.4/config -lpython2.4
>
> We don't need '-L/pkg/python-2.4/lib' as there's nothing in there.
Okay, I'll implement this.

> % python get-py-info.py --link
> gcc -pthread -shared -L/usr/lib/python2.4/config -lpython2.4
> % python get-py-info.py --libs
> -L/usr/lib/python2.4/config -lpython2.4
>
> Again, this is wrong. It should prefer the DSO sitting in /usr/lib. The
> 'correct' output for Ubuntu would be (and this is what trunk emits):
> % python ./build/get-py-info.py --link
> gcc -pthread -shared -lpython2.4
> % python ./build/get-py-info.py --libs
> -lpython2.4
Okay, I'll implement this.

> The version of get-py-info.py in trunk has some stat()'s to try to prevent us
> from emitting bogus paths and to explicitly prefer DSOs over .a files.
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.)
---
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.)
---
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 20:03:23 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.