classification
Title: test_distutils spews linker messages on Windows
Type: behavior Stage: resolved
Components: Distutils, Tests, Windows Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Segev Finer, dstufft, eric.araujo, paul.moore, steve.dower, terry.reedy, tim.golden, vstinner, zach.ware
Priority: normal Keywords:

Created on 2016-08-17 21:21 by terry.reedy, last changed 2021-02-03 18:21 by steve.dower. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2814 closed Segev Finer, 2017-07-22 14:03
Messages (6)
msg272991 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-08-17 21:21
3.6, Win10, VS recently reinstalled to 'Update 3'.  I believe these messages are somewhat new.

0:01:00 [111/402] test_distutils failed (env changed)
xxmodule.c
   Creating library C:\Users\Terry\AppData\Local\Temp\tmpbjffnmc3\Debug\Users\Terry\AppData\Local\Temp\tmpbjffnmc3\xx_d.cp36-win32.lib and object C:\Users\Terry\AppData\Local\Temp\tmpbjffnmc3\Debug\Users\Terry\AppData\Local\Temp\tmpbjffnmc3\xx_d.cp36-win32.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
foo.c
   Creating library C:\Users\Terry\AppData\Local\Temp\tmp7302jrpo\tempt\Users\Terry\AppData\Local\Temp\tmp9132twos\foo_d.cp36-win32.lib and object C:\Users\Terry\AppData\Local\Temp\tmp7302jrpo\tempt\Users\Terry\AppData\Local\Temp\tmp9132twos\foo_d.cp36-win32.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
foo.c
   Creating library C:\Users\Terry\AppData\Local\Temp\tmp7302jrpo\tempt\Users\Terry\AppData\Local\Temp\tmp9132twos\foo_d.cp36-win32.lib and object C:\Users\Terry\AppData\Local\Temp\tmp7302jrpo\tempt\Users\Terry\AppData\Local\Temp\tmp9132twos\foo_d.cp36-win32.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
xxmodule.c
   Creating library C:\Users\Terry\AppData\Local\Temp\tmp9hq4ci8e\Debug\Users\Terry\AppData\Local\Temp\tmp9hq4ci8e\xx_d.cp36-win32.lib and object C:\Users\Terry\AppData\Local\Temp\tmp9hq4ci8e\Debug\Users\Terry\AppData\Local\Temp\tmp9hq4ci8e\xx_d.cp36-win32.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
foo.c
   Creating library C:\Users\Terry\AppData\Local\Temp\tmp3qv0ulce\tempt\Users\Terry\AppData\Local\Temp\tmph1jy_aqh\foo_d.cp36-win32.lib and object C:\Users\Terry\AppData\Local\Temp\tmp3qv0ulce\tempt\Users\Terry\AppData\Local\Temp\tmph1jy_aqh\foo_d.cp36-win32.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
foo.c
   Creating library C:\Users\Terry\AppData\Local\Temp\tmp3qv0ulce\tempt\Users\Terry\AppData\Local\Temp\tmph1jy_aqh\foo_d.cp36-win32.lib and object C:\Users\Terry\AppData\Local\Temp\tmp3qv0ulce\tempt\Users\Terry\AppData\Local\Temp\tmph1jy_aqh\foo_d.cp36-win32.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
xxmodule.c
   Creating library build\temp.win32-3.6-pydebug\Debug\xx_d.cp36-win32.lib and object build\temp.win32-3.6-pydebug\Debug\xx_d.cp36-win32.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance

F:\Python\dev\36\build\test_python_3596>exit 1

F:\Python\dev\36\build\test_python_3596>exit 0
Warning -- files was modified by test_distutils
msg272999 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-08-17 22:47
It certainly looks like more than we used to get...

Ideally we'd capture the output from the build process and only write it out if the test failed. I'm not entirely sure why that isn't happening here. The warnings themselves are harmless (you get a nearly identical warning if you *don't* put /LTCG on the command line and need it - I'd guess there was a stalemate between two factions on the compiler team at some point and they resolved it with this warning).
msg298848 - (view) Author: Segev Finer (Segev Finer) * Date: 2017-07-22 13:51
We are getting those warnings because distutils builds extension modules without /GL (https://msdn.microsoft.com/en-us/library/0zza0de8.aspx) but with /LTCG (https://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx). We should either add /GL to truly enable whole program optimizations/link-time code generation or remove it.

It is added in https://github.com/python/cpython/blob/896145d9d266ee2758cfcd7691238cbc1f9e1ab8/Lib/distutils/_msvccompiler.py#L233-L241.
msg298850 - (view) Author: Segev Finer (Segev Finer) * Date: 2017-07-22 14:00
Investigated some more. We are adding /GL for release but not in debug. But adding /LTCG for both debug and release.
msg298859 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-07-22 16:11
With the patch, I still see the Creating ... messages but without the LINK: warning.  It *seems* like a no-brainer to apply the patch. 

With those gone, it would seem reasonable to intercept the message as Steve described and only print it if it contains 'LINK' or if the test fails.
msg386348 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:21
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2021-02-03 18:21:22steve.dowersetstatus: open -> closed
resolution: out of date
messages: + msg386348

stage: resolved
2017-07-22 16:11:04terry.reedysetmessages: + msg298859
2017-07-22 14:03:55Segev Finersetpull_requests: + pull_request2866
2017-07-22 14:00:59Segev Finersetmessages: + msg298850
2017-07-22 13:51:32Segev Finersetversions: + Python 3.5, Python 3.6, Python 3.7
nosy: + Segev Finer

messages: + msg298848

type: behavior
2016-08-17 22:47:38steve.dowersetmessages: + msg272999
2016-08-17 21:21:21terry.reedycreate