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: python-config.sh vs python-config.py inconsistency
Type: Stage: patch review
Components: Installation, macOS Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: isuruf, millert, ned.deily, ronaldoussoren, vstinner
Priority: normal Keywords: patch

Created on 2021-05-19 23:12 by millert, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 28725 open isuruf, 2021-10-04 19:43
Messages (4)
msg393985 - (view) Author: Todd C. Miller (millert) Date: 2021-05-19 23:12
There is an inconsistency between python-config.py and python-config.sh with the output of --ldflags.  The .sh version include -L$libdir but the .py version does not include the -L flag unless a non-shared version of Python is built.

As a result, on Darwin (macOS), where python-config.py is used it is not possible to use python-config to get the correct linker flags when "python-config --embed --ldflags" is run if Python is installed in a directory with a lib dir that is not in the compiler's default search path.

For example, if Python is installed in /usr/local/python, we see the following on Linux (using python-config.sh):

$ python3-config --ldflags --embed
 -L/usr/local/python/lib -lpython3.10 -lcrypt -lpthread -ldl  -lutil -lm -lm

But on macOS, using python-config.py:

$ python3-config --ldflags --embed
-lpython3.10 -lintl -ldl -framework CoreFoundation

There is no -L flag to tell the compiler where to find the python3.10 library, so an attempt to link with it will fail.
msg403113 - (view) Author: Isuru Fernando (isuruf) * Date: 2021-10-03 21:44
Agree that this should be fixed. If you want, I can send a PR.
msg403118 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-10-04 00:21
> If you want, I can send a PR.

Thanks, that would be good. Embedding is something we currently don't really test, unfortunately. Off the top of my head, I'm not sure how feasible it would be to add some tests for embedding, especially given the range of configurations we support but something would be better than nothing.
msg403134 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-10-04 12:54
Maybe unit tests can be written on python-config.sh and python-config.py commands.
History
Date User Action Args
2022-04-11 14:59:45adminsetgithub: 88348
2021-10-04 19:43:26isurufsetkeywords: + patch
stage: patch review
pull_requests: + pull_request27071
2021-10-04 12:54:44vstinnersetnosy: + vstinner
messages: + msg403134
2021-10-04 00:21:24ned.deilysetmessages: + msg403118
2021-10-03 21:44:42isurufsetnosy: + isuruf
messages: + msg403113
2021-05-20 02:01:47ned.deilysetnosy: + ned.deily, ronaldoussoren
components: + macOS
2021-05-19 23:12:10millertcreate