New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Letting "build_ext --libraries" take more than one lib #42479
Comments
It's impossible to specify more than one external library to link using The problem exists in python 2.3.5, 2.4.1, 2.4.2 and in cvs HEAD. |
Another bug day task |
This one is really annoying. Could you please consider fixing this one for the next release? (=lightweight change) |
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. |
I applied the patch proposed by slanger. This one is working. |
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) |
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:
+ 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. |
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 :) |
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. |
New changeset 53df93a9c002 by Éric Araujo in branch '3.2': New changeset f7163afecb97 by Éric Araujo in branch 'default': |
New changeset 96f5718bf005 by Éric Araujo in branch '2.7': |
New changeset 4ba43318e56b by Éric Araujo in branch 'default': |
New changeset 60dd0041c9bc by Éric Araujo in branch 'default': New changeset 158697fd8fa1 by Éric Araujo in branch 'python3': |
Here you are! Thanks for the testing. |
New changeset 77ac369fbbf1 by Éric Araujo in branch '3.2': |
New changeset 98fb1c0fc7a0 by Éric Araujo in branch 'default': |
New changeset db1c52aa4d2a by Éric Araujo in branch '2.7': |
Another instance of this is bpo-1703178. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: