homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Letting "build_ext --libraries" take more than one lib
Type: behavior Stage: resolved
Components: Distutils, Distutils2 Versions: Python 3.2, Python 3.3, Python 2.7, 3rd party
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: christian.heimes, eric.araujo, eric.snow, palm.kevin, pitrou, python-dev, slanger, tarek
Priority: normal Keywords: patch

Created on 2005年10月13日 19:07 by slanger, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
build_ext.diff slanger, 2005年10月13日 19:07 patch for build_ext.py
Messages (18)
msg48863 - (view) Author: Stephen A. Langer (slanger) Date: 2005年10月13日 19:07
It's impossible to specify more than one external library to link using 
build_ext --libraries. Bug 716634 says that the problem is fixed, but it isn't. 
Assuming that the desired format is --libraries="lib1 lib2 etc", then there's a 
simple one line fix which I've attached. 
The problem exists in python 2.3.5, 2.4.1, 2.4.2 and in cvs HEAD. 
msg59315 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008年01月05日 19:40
Another bug day task
msg121221 - (view) Author: Palm Kevin (palm.kevin) Date: 2010年11月15日 11:17
This one is really annoying. Could you please consider fixing this one for the next release? (=lightweight change)
msg121223 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010年11月15日 11:37
Distutils is frozen and we fix only bugs. This case is a little bit at the edge. 
Can you show us an example of a call you are trying to make, and the gcc command line output that fails ? 
I want to see if we can find a workaround. If so, this will be changed only in Distutils2. If not I'll change this to a bug and we'll fix it in distutils too.
msg121225 - (view) Author: Palm Kevin (palm.kevin) Date: 2010年11月15日 12:31
I applied the patch proposed by slanger. This one is working.
Now, I'm executing this instruction to build my extension:
"%pythonRoot%\python.exe" setup.py build_ext --include-dirs "C:\MyApp\include" --library-dir "C:\MyApp\lib" --libraries "myLib1 myLib2"
If I don't use the patch, then the error I get is 'unresolved external symbol _xxx referenced in function _abc'. Which is quite normal since I can only point to one library...
msg121236 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010年11月15日 16:26
Since "--libraries" is plural, and since the help text says:
--libraries (-l) external C libraries to link with
it should IMO be considered a bug.
(Standard UNIX linkers have a different convention: you can specify -l several times in order to link against several libraries; however, distutils seems to ignore all but the last -l option)
msg121260 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010年11月16日 03:08
I agree this is a bug: it’s a broken feature, not a new one, even if it can be argued that fixing a long-standing behavior enables new usages, and is thus comparable to a new feature.
I found no mention of --libraries in the docs, so I looked at the file history, and it’s clear that the intent of the code does not match its behavior. The fix is simple:
- if isinstance(self.libraries, str):
- self.libraries = [self.libraries]
+ self.ensure_string_list('libraries')
I guess Greg forgot to change that line of code when he invented the ensure_* methods. No test is broken by this change. Do we need a regression test for this? It’s not strictly required IMO.
FTR, in distutils2, I want to make the types and formats clear for everything. For example, build_ext.swig_opts is defined as "a list" in the current docs, this time with an example that shows it’s space-separated ("--swig-opts="-modern -I../include""). The code does not use ensure_string_list, and hence does not support comma-separated. IMO, any value described as list should accept space-separated and comma-separated. This is probably out of scope for distutils, but something I definitely want to improve in distutils2. Supporting multiple options (-lm -lfoo) is IMO feasible too.
msg121262 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010年11月16日 03:40
I’ve reviewed other modules for the same error and found two candidates: config.libraries, the same thing as build_ext.libraries, and install.extra_path, for which I’m not sure.
(More distutils2 thoughts: A number of options are split on os.pathsep, a new ensure_dirs_list method looks in order. Regarding the type system, an angry comment in build_py confirmed the need :)
msg153367 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2012年02月14日 19:37
Ran into this bug today in 2.7 (building python-sybase with freetds). The fix in msg121260 took care of it (didn't try the patch). Thanks, Éric. 
Is this something that could get patched in the upcoming micro releases? It's not so important for me at this point, and I'm not sure how often it will come up, but it's also a very simple fix.
msg153408 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年02月15日 16:15
New changeset 53df93a9c002 by Éric Araujo in branch '3.2':
Fix parsing of build_ext --libraries option (#1326113)
http://hg.python.org/cpython/rev/53df93a9c002
New changeset f7163afecb97 by Éric Araujo in branch 'default':
Merge fixes for #1326113 and #12297 from 3.2
http://hg.python.org/cpython/rev/f7163afecb97 
msg153409 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年02月15日 16:15
New changeset 96f5718bf005 by Éric Araujo in branch '2.7':
Fix parsing of build_ext --libraries option (#1326113)
http://hg.python.org/cpython/rev/96f5718bf005 
msg153411 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年02月15日 16:25
New changeset 4ba43318e56b by Éric Araujo in branch 'default':
Fix parsing of packaging’s build_ext --libraries option (#1326113)
http://hg.python.org/cpython/rev/4ba43318e56b 
msg153412 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年02月15日 16:39
New changeset 60dd0041c9bc by Éric Araujo in branch 'default':
Fix parsing of build_ext --libraries option (#1326113)
http://hg.python.org/distutils2/rev/60dd0041c9bc
New changeset 158697fd8fa1 by Éric Araujo in branch 'python3':
Merge #1326113 fix from default
http://hg.python.org/distutils2/rev/158697fd8fa1 
msg153413 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012年02月15日 16:41
Here you are! Thanks for the testing.
msg153418 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年02月15日 17:13
New changeset 77ac369fbbf1 by Éric Araujo in branch '3.2':
Fix test failure for shared builds caused by #1326113 fix
http://hg.python.org/cpython/rev/77ac369fbbf1 
msg153419 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年02月15日 17:14
New changeset 98fb1c0fc7a0 by Éric Araujo in branch 'default':
Fix for packaging test failure on shared builds (#1326113)
http://hg.python.org/cpython/rev/98fb1c0fc7a0 
msg153420 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年02月15日 17:15
New changeset db1c52aa4d2a by Éric Araujo in branch '2.7':
Fix test failure for shared builds caused by #1326113 fix
http://hg.python.org/cpython/rev/db1c52aa4d2a 
msg158949 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012年04月22日 05:58
Another instance of this is #1703178.
History
Date User Action Args
2022年04月11日 14:56:13adminsetgithub: 42479
2012年04月22日 05:58:51eric.araujosetmessages: + msg158949
2012年02月15日 17:15:04python-devsetmessages: + msg153420
2012年02月15日 17:14:57python-devsetmessages: + msg153419
2012年02月15日 17:13:13python-devsetmessages: + msg153418
2012年02月15日 16:41:29eric.araujosetstatus: open -> closed
versions: + Python 3.3, - Python 3.1
messages: + msg153413

resolution: fixed
stage: test needed -> resolved
2012年02月15日 16:39:58python-devsetmessages: + msg153412
2012年02月15日 16:25:34python-devsetmessages: + msg153411
2012年02月15日 16:15:55python-devsetmessages: + msg153409
2012年02月15日 16:15:07python-devsetnosy: + python-dev
messages: + msg153408
2012年02月14日 19:37:30eric.snowsetnosy: + eric.snow
messages: + msg153367
2010年11月16日 03:40:50eric.araujosetmessages: + msg121262
2010年11月16日 03:08:31eric.araujosetassignee: tarek -> eric.araujo
type: enhancement -> behavior
components: + Distutils2
versions: + 3rd party, Python 3.1, Python 2.7
nosy: slanger, pitrou, christian.heimes, tarek, eric.araujo, palm.kevin
messages: + msg121260
stage: test needed
2010年11月16日 02:23:25eric.araujolinkissue716634 superseder
2010年11月15日 16:26:21pitrousetnosy: + pitrou, eric.araujo
messages: + msg121236
2010年11月15日 12:31:26palm.kevinsetmessages: + msg121225
2010年11月15日 11:37:37tareksetmessages: + msg121223
2010年11月15日 11:17:01palm.kevinsetnosy: + palm.kevin
messages: + msg121221
2010年07月10日 22:56:48terry.reedysetversions: + Python 3.2, - Python 2.6, Python 3.0, Python 3.1, Python 2.7
2009年02月08日 19:32:41tareksetassignee: tarek
versions: + Python 3.0, Python 3.1, Python 2.7
2009年02月08日 18:57:48akitadasetnosy: + tarek
type: enhancement
2008年01月05日 19:40:31christian.heimessetnosy: + christian.heimes
messages: + msg59315
versions: + Python 2.6
2005年10月13日 19:07:43slangercreate

AltStyle によって変換されたページ (->オリジナル) /