classification
Title: test_distutils fails when configured --with-lto
Type: Stage:
Components: Build Versions: Python 3.6, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: alecsandru.patrascu, gregory.p.smith, inada.naoki
Priority: normal Keywords: patch

Created on 2016-04-17 06:21 by gregory.p.smith, last changed 2017-02-17 08:40 by inada.naoki.

Files
File name Uploaded Description Edit
issue26787.patch alecsandru.patrascu, 2016-04-18 13:46 review
Messages (6)
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/test_sysconfig.py", line 156, in test_sysconfig_compiler_vars
    sysconfig.get_config_var('LDSHARED'))
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/test_sysconfig.py", line 133, in test_sysconfig_module
    sysconfig.get_config_var('LDFLAGS'))
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
Hello,

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 (inada.naoki) * (Python committer) Date: 2016-12-26 13:13
LGTM
msg287978 - (view) Author: INADA Naoki (inada.naoki) * (Python committer) Date: 2017-02-17 08:40
Would you send pull request on Github?
History
Date User Action Args
2017-02-17 08:40:38inada.naokisetmessages: + msg287978
2016-12-26 13:13:06inada.naokisetnosy: + inada.naoki
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