Title: Using LDFLAGS='-rpath=\$$LIB:/some/other/path' ./configure breaks the build
Type: compile error Stage:
Components: Distutils Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: tarek Nosy List: flub, tarek
Priority: normal Keywords: patch

Created on 2009-02-10 11:44 by flub, last changed 2009-06-11 08:35 by tarek. This issue is now closed.

File name Uploaded Description Edit
makevars.diff flub, 2009-05-02 22:26 Do not consider $$ as a variable in makefile parsing
makevars2.diff flub, 2009-05-11 23:06 Don't treat $$ as a variable but replace it by single $
Messages (8)
msg81538 - (view) Author: Floris Bruynooghe (flub) Date: 2009-02-10 11:44
When specifying an RPATH with -rpath or -R you can use the special
tokens `$LIB' and `$ORIGIN' which the runtime linker interprets as
"normal search path" and "relative to current sofile" respectively.  To
get these correctly to the gcc command line you need to specify this in
LDFLAGS as `\$$LIB' to work around escapes of both the makefile and
shell, so in the Python Makefile this will appear somewhere as (this is
on one line):

CONFIG_ARGS=	 '--prefix=/opt/'

This works for compiling the main python binary.  But when the extension
modules get compiled distutils chokes on this. 
distutils.sysconfig.parse_makefile() does think that any value of a
variable that contains `$' in it refers to an other variable in the
makefile.  It will fail to find the value and CONFIG_ARGS will not be
defined.  This then fails in for the _ctypes extension:

if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):

Where `None' is returned instead of a list by .get_config_var().

It seems that distutils.sysconfig.parse_makefile() needs to understand
more of the makefile synatax to deal with this.
msg86986 - (view) Author: Floris Bruynooghe (flub) Date: 2009-05-02 22:26
The attached patch does fix this issue.

Concerning the specific example of LDFLAGS used here there is still and
issue with LDFLAGS being ignored by the buid for the shared modules, but
that is an other issue.
msg86989 - (view) Author: Floris Bruynooghe (flub) Date: 2009-05-02 23:52
Hmm, the patch isn't quite right yet.  When a $$ is present in the
makefile .parse_makefile() needs to return a single $.  I'm not sure yet
what needs to happen with the \ for the shell escape.
msg87595 - (view) Author: Floris Bruynooghe (flub) Date: 2009-05-11 23:06
The updated patch inserts the single $ when needed.  I've checked this
on compiling python, stdlib extension modules and custom extension
modules and this gives the correct results in all cases.
msg87613 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-05-12 10:21
The patch looks good, beside the fact that you didn't call super() in

I'll commit it asap and fix that small issue
msg87636 - (view) Author: Floris Bruynooghe (flub) Date: 2009-05-12 14:46
Oh, sorry about the super() that is why the ar test failed then.  Sorry,
I got a little confused by the conflicting update on that file while
working on this patch and must have merged it badly.
msg89197 - (view) Author: Floris Bruynooghe (flub) Date: 2009-06-10 11:23

What's the status of this?  I haven't seen a commit message regarding this.

msg89239 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-06-11 08:35
done in r73341 in trunk. I've backported it as well in 2.6/3.0/3.1
branches. (r73342, r73343, r73344)

Thanks !
Date User Action Args
2015-04-15 01:56:03ned.deilylinkissue1481347 superseder
2009-06-11 08:35:54tareksetstatus: open -> closed

messages: + msg89239
2009-06-10 11:23:30flubsetmessages: + msg89197
2009-05-12 14:46:00flubsetmessages: + msg87636
2009-05-12 10:21:16tareksetmessages: + msg87613
2009-05-11 23:06:57flubsetfiles: + makevars2.diff

messages: + msg87595
2009-05-02 23:52:20flubsetmessages: + msg86989
2009-05-02 22:26:01flubsetfiles: + makevars.diff
keywords: + patch
messages: + msg86986
2009-02-13 09:00:59tareksetpriority: normal
versions: + Python 3.1, - Python 2.5
2009-02-10 11:44:50flubcreate