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.

Title: setting CC no longer overrides default linker for extension module builds on OS X
Type: behavior Stage: resolved
Components: Distutils, macOS Versions: Python 3.3, Python 3.4, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: jaraco, ned.deily, python-dev, ronaldoussoren, tarek
Priority: normal Keywords: patch

Created on 2013-05-28 09:27 by ned.deily, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
issue18080_ldshared_2.7.patch ned.deily, 2013-05-28 09:30 patch and tests for 2.7
Messages (9)
msg190182 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-05-28 09:27
As part of the initial changes for Issue13590 in 2.7.3, 3.2.3, and 3.3 (prior to release) to Distutils to support building extension modules on OS X with Xcode 4, code was added to substitute the clang compiler if the older gcc-4.2 supplied with Xcode 3 was not found.  In addition, the changes made it easier for the user to override the compiler for both the compile and linking stages: "Also as a convenience, if the user does explicitly set CC, substitute its value as the default compiler in the Distutils LDSHARED configuration variable for OS X."  This eliminated the need to construct a complete LDSHARED value.  For 2.7.4, 3.2.4, and 3.3.0, more extensive changes were made to fully support the latest releases of Xcode 4.  Unfortunately, the code to override LDSHARED if CC is set was inadvertently deleted for these later releases.  The attached patch restores the deleted override behavior and adds tests.
msg190197 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-05-28 11:45
msg190258 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-05-28 23:45
New changeset ca24bc6a5a4b by Ned Deily in branch '2.7':
Issue #18080: When building a C extension module on OS X, if the compiler

New changeset 75432fb6b9af by Ned Deily in branch '3.3':
Issue #18080: When building a C extension module on OS X, if the compiler

New changeset 0512bb1b5b8a by Ned Deily in branch 'default':
Issue #18080: merge from 3.3
msg190259 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-05-28 23:48
Committed for release with 2.7.6 and 3.3.3.
msg372829 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-07-02 08:56
In [pypa/distutils#1](, I learned that the test doesn't have the intended effect. Patching `get_config_var()` has no effect because the function under test calls `get_config_vars()`. In some environments, such as PyPy3 as built on Homebrew, the first test fails.
msg372831 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-07-02 09:09
For easy reference, the relevant commit is
msg372843 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-07-02 10:49
Jason, what action(s) are you expecting with regard to this and by whom? This issue has been long closed.
msg373004 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-07-04 23:57
Well, the issue is potentially ignorable, especially if distutils is deprecated and removed from CPython. Alternately, CPython could adopt the [patch from distutils]( that corrects the issue. Would you like me to file a separate bug for this issue? Or apply that patch? Or something else?
msg373092 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-07-06 11:00
> Would you like me to file a separate bug for this issue? Or apply that patch? Or something else?

OK, if I understand correctly, the problem you describe does not affect cPython because cPython's Distutils does not use get_config_vars(), only get_config_var(); but other implementation's ports of Distutils may have diverged to use get_config_vars and so the test may fail when running under those implementations using setuptools with its newly cloned version of cPython Distutils.  If that is the case, I think it's fine to backport the fix to cPython tests in the interest of minimizing differences. Since it is minor and not really user visible, if you're willing to do so, I'm OK with a PR under this bpo and I don't think a NEWS blurb is necessary.  Thanks for bringing it up.
Date User Action Args
2022-04-11 14:57:46adminsetgithub: 62280
2020-07-06 11:00:20ned.deilysetmessages: + msg373092
2020-07-04 23:57:52jaracosetmessages: + msg373004
2020-07-02 10:49:25ned.deilysetmessages: + msg372843
2020-07-02 09:09:33jaracosetmessages: + msg372831
2020-07-02 08:56:49jaracosetnosy: + jaraco
messages: + msg372829
2013-05-28 23:48:57ned.deilysetstatus: open -> closed
resolution: fixed
messages: + msg190259

stage: patch review -> resolved
2013-05-28 23:45:40python-devsetnosy: + python-dev
messages: + msg190258
2013-05-28 11:45:55ronaldoussorensetmessages: + msg190197
2013-05-28 09:30:45ned.deilysetfiles: + issue18080_ldshared_2.7.patch
nosy: + ronaldoussoren
keywords: + patch
2013-05-28 09:27:55ned.deilycreate