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: make profile-opt includes -fprofile* flags in _sysconfigdata CFLAGS
Type: behavior Stage: resolved
Components: Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: make profile-opt: test_distutils failure
View: 23390
Assigned To: gregory.p.smith Nosy List: bkabrda, gregory.p.smith, ned.deily
Priority: normal Keywords: patch

Created on 2014-11-19 22:55 by gregory.p.smith, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue22904-test-workaround-gps01.diff gregory.p.smith, 2014-11-19 23:25 review
Messages (6)
msg231401 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2014-11-19 22:55
1) Checkout a 3.4 tree.  Mine was at revision d244e1770f1b.
2) ./configure
3) make -j14 profile-opt
4) ./python -m test.regrtest -v test_distutils

FAIL: test_sysconfig_module (distutils.tests.test_sysconfig.SysconfigTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/.../oss/cpython/3.4/Lib/distutils/tests/test_sysconfig.py", line 131, in test_sysconfig_module
    sysconfig.get_config_var('CFLAGS'))
AssertionError: '-Wno[38 chars] -Wall -Wstrict-prototypes  -fprofile-use -fprofile-correction' != '-Wno[38 chars] -Wall -Wstrict-prototypes'

This can be traced to the built _sysconfigdata.py file which contains the command line passed CFLAGS from the build_all_use_profile target's sub-make vs the distutils.sysconfig module's Makefile parsing which finds the PY_CFLAGS value from the Makefile itself.

One of either stripping the profile-opt related flags out when generating _sysconfigdata.py or explicitly generating a good _sysconfigdata.py file outside of the sub-make's with the profiling generate or use flags seems like a good idea.  The latter is likely easier; just regenerate _sysconfigdata.py after the sub-make.
msg231402 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2014-11-19 22:58
Should _sysconfigdata.py contain these flags for reference, implying that it is this test or distutils.sysconfig implementation which is really wrong?
msg231403 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2014-11-19 23:25
attaching a proposed workaround in the unittest.
msg235371 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2015-02-04 04:20
see also issue23390
msg239135 - (view) Author: Bohuslav "Slavek" Kabrda (bkabrda) * Date: 2015-03-24 14:55
I'm also hitting an issue with test_sysconfig_module, but for a different reason: While building Python, I used "make EXTRA_CFLAGS='some flags'" and this makes test_sysconfig_module fail when I run "make test" or "python -m test.regrtest".

The problem is that EXTRA_CFLAGS, like profile-opt, is not in the Makefile, so _sysconfigdata has it stored from build - unlike distutils, which can't see the EXTRA_CFLAGS variable in the environment, thus resulting in failure.

I'm not sure what's the proper solution here, but I think requiring people to run "make test" with precisely the same EXTRA_CFLAGS as "make" is not right (although it solves the issue). This makes me think this is a bug - should I open a new issue?
msg239224 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-03-25 06:40
Slavek, this issue and its superseder are both closed so comments here will likely not be acted on.
History
Date User Action Args
2022-04-11 14:58:10adminsetgithub: 67093
2015-03-25 06:40:47ned.deilysetnosy: + ned.deily

messages: + msg239224
stage: needs patch -> resolved
2015-03-24 14:55:31bkabrdasetnosy: + bkabrda
messages: + msg239135
2015-02-04 04:21:00gregory.p.smithsetstatus: open -> closed
resolution: duplicate
2015-02-04 04:20:25gregory.p.smithsetsuperseder: make profile-opt: test_distutils failure
messages: + msg235371
2014-11-19 23:25:44gregory.p.smithsetfiles: + issue22904-test-workaround-gps01.diff
keywords: + patch
messages: + msg231403
2014-11-19 22:59:00gregory.p.smithsettitle: make profile-opt fails to update _sysconfigdata.py during the rebuild -> make profile-opt includes -fprofile* flags in _sysconfigdata CFLAGS
2014-11-19 22:58:19gregory.p.smithsetmessages: + msg231402
2014-11-19 22:55:34gregory.p.smithcreate