Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79803

Re: Build Question: How to Add -Wl, --option Before Objects In Setup.py?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'modified': 0.07; 'subject:Question': 0.07; 'append': 0.09; 'line:': 0.09; 'linker': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'setup.py': 0.09; 'subject:How': 0.10; 'python': 0.11; 'objects.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:[ 30': 0.16; 'subject:Add': 0.16; 'variable.': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'basically': 0.19; 'seems': 0.21; 'command': 0.22; 'header:User-Agent:1': 0.23; 'copied': 0.24; 'instance,': 0.24; 'skip:e 30': 0.24; 'environment': 0.24; 'script': 0.25; 'pass': 0.26; 'values': 0.27; 'header:X -Complaints-To:1': 0.27; "i'm": 0.30; 'option': 0.32; 'run': 0.32; 'another': 0.32; 'add': 0.35; 'building': 0.35; 'charset:us- ascii': 0.36; 'subject:?': 0.36; 'should': 0.36; 'skip:- 20': 0.37; 'area': 0.37; 'being': 0.38; 'depends': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'most': 0.60; 'back': 0.62; 'subject:Build': 0.68; 'default': 0.69; 'received:204': 0.75; 'article': 0.77; 'ldflags': 0.84; 'received:204.14': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ned Deily <nad@acm.org>
Subject Re: Build Question: How to Add -Wl, --option Before Objects In Setup.py?
Date Mon, 27 Oct 2014 13:39:32 -0700
References <CAHu5PrbHSob2r-zOTCtrYiqdudU_q+4mDXOXzp=_ReJp7khTDg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 204.14.154.216
User-Agent MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15243.1414442387.18130.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1414442387 news.xs4all.nl 2952 [2001:888:2000:d::a6]:45716
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:79803

Show key headers only | View raw


In article 
<CAHu5PrbHSob2r-zOTCtrYiqdudU_q+4mDXOXzp=_ReJp7khTDg@mail.gmail.com>,
 Cyd Haselton <chaselton@gmail.com> wrote:
> I need to add a linker option to the command(s) run by setup.py when
> building various objects.  I'm not familiar with Python at all, so I
> basically copied and modified a line from one area of the script to
> another
> 
> 
> ext_modules=[Extension('_struct', ['_struct.c'], extra_link_args =
> ['Wl,--allow-shlib-undefined'])],
>                      *snip*
> 
> Unfortunately this seems to append the option to the end of the
> command line.  What's the best (fastest) way to add it before the
> object being built (objectname.o)?

It depends on what system and build tools that you are using and that 
the Python you are using was built with but, in general on most 
POSIX-like systems, one way to do it should be to supply it via an 
LDFLAGS environment variable.  The safest approach would be to get the 
default value of LDFLAGS for this Python instance, append your 
additional values to it, and pass it back into the setup.py build.  You 
can do that all in one line:

LDFLAGS="$(python -c 'import 
sysconfig;print(sysconfig.get_config_var("LDFLAGS"))') 
-Wl,--allow-shlib-undefined" python setup.py build

-- 
 Ned Deily,
 nad@acm.org

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Build Question: How to Add -Wl, --option Before Objects In Setup.py? Ned Deily <nad@acm.org> - 2014-10-27 13:39 -0700

csiph-web