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


Groups > comp.lang.python > #79803 > unrolled thread

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

Started byNed Deily <nad@acm.org>
First post2014-10-27 13:39 -0700
Last post2014-10-27 13:39 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromNed Deily <nad@acm.org>
Date2014-10-27 13:39 -0700
SubjectRe: Build Question: How to Add -Wl, --option Before Objects In Setup.py?
Message-ID<mailman.15243.1414442387.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web