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: test_distutils fails when configured --with-lto
Type: Stage: resolved
Components: Build Versions: Python 3.6, Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: alecsandru.patrascu, gregory.p.smith, methane
Priority: normal Keywords: patch

Created on 2016-04-17 06:21 by gregory.p.smith, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
issue26787.patch alecsandru.patrascu, 2016-04-18 13:46 review
Messages (7)
msg263598 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2016-04-17 06:21
When configured using './configure --with-lto' (added in issue25702) and doing a 'make profile-opt' build, test_distutils fails:

FAIL: test_sysconfig_compiler_vars (distutils.tests.test_sysconfig.SysconfigTestCase)
Traceback (most recent call last):
  File "/home/greg/sandbox/python/cpython/3.5/Lib/distutils/tests/", line 156, in test_sysconfig_compiler_vars
AssertionError: 'gcc -pthread -shared -flto -fuse-linker-plugin -ffat-lto-obje[20 chars]none' != 'gcc -pthread -shared'
- gcc -pthread -shared -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none
+ gcc -pthread -shared

FAIL: test_sysconfig_module (distutils.tests.test_sysconfig.SysconfigTestCase)
Traceback (most recent call last):
  File "/home/greg/sandbox/python/cpython/3.5/Lib/distutils/tests/", line 133, in test_sysconfig_module
AssertionError: '-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none' != ''
- -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none
msg263624 - (view) Author: Alecsandru Patrascu (alecsandru.patrascu) * Date: 2016-04-17 19:52
I will investigate this and submit a fix. At a first glance, it seems the test is failing because it does not have the knowledge of the LTO flags.
msg263666 - (view) Author: Alecsandru Patrascu (alecsandru.patrascu) * Date: 2016-04-18 13:46

You can find a patch for this issue attached. Basically, since LTO needs LD flags when used, I modified the makefile template file and the test to push the flags up to the sysconfig module.
msg263673 - (view) Author: Alecsandru Patrascu (alecsandru.patrascu) * Date: 2016-04-18 16:55
This patch is for CPython 3, and if it looks good I will post also the CPython 2 version.
msg284027 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2016-12-26 13:13
msg287978 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2017-02-17 08:40
Would you send pull request on Github?
msg336187 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2019-02-21 06:59
Fixed in bpo-35257
Date User Action Args
2022-04-11 14:58:29adminsetgithub: 70974
2019-02-21 06:59:15methanesetstatus: open -> closed
resolution: fixed
messages: + msg336187

stage: resolved
2017-02-17 08:40:38methanesetmessages: + msg287978
2016-12-26 13:13:06methanesetnosy: + methane
messages: + msg284027
2016-04-18 16:55:22alecsandru.patrascusetmessages: + msg263673
2016-04-18 13:46:45alecsandru.patrascusetfiles: + issue26787.patch
keywords: + patch
messages: + msg263666
2016-04-17 19:52:48alecsandru.patrascusetmessages: + msg263624
2016-04-17 06:21:50gregory.p.smithlinkissue25702 dependencies
2016-04-17 06:21:25gregory.p.smithcreate