Title: ICC compiler check is too permissive
Type: compile error Stage: patch review
Components: Installation Versions: Python 3.11, Python 3.10, Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: josh.r, locutusofborg, struktured, vstinner, zach.ware
Priority: normal Keywords: patch

Created on 2016-11-01 21:22 by struktured, last changed 2021-10-19 22:23 by zach.ware.

File name Uploaded Description Edit
icc-pattern-check-fix.patch struktured, 2016-11-01 21:22 suggested patch review
icc-find.patch locutusofborg, 2018-05-17 15:12
icc-find-v2.patch locutusofborg, 2018-05-17 15:15
Messages (4)
msg279893 - (view) Author: Carmelo Piccione (struktured) Date: 2016-11-01 21:22
if the ${CC} variable has an encoded path which contains "icc" anywhere in the string, it will be interpreted by the configure script as an icc compiler rather than gcc. This is due to matching on *icc* in various places.

Example: "/home/cpiccion/.linuxbrew/bin/gcc" will match because of the "cpiccion".

This is also true for the other patterns, including "gcc".

Proposed fix is to take the basename of the ${CC} variable first.
msg280049 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2016-11-04 15:07
It's probably bad form, but I've seen people set CC to name/path to compiler followed by switches, e.g.:

   export CC='gcc -march=native -O3'

or the like (usually because they want to keep the build tool's default CFLAGS, and setting CFLAGS causes them to be replaced, not supplemented).

basename seems to strip the leading path components, but if someone shoved in other switches, they aren't removed, so if they happen to have "icc" in them, this would still have issues. Perhaps a basename followed by splitting on whitespace and only keeping the first component? Not a configure expert, not sure what's possible.
msg316944 - (view) Author: Gianfranco (locutusofborg) * Date: 2018-05-17 15:12
I'm attaching the patch that works also for parameters, e.g. when CC contains --sysroot=/home/icc or similar.
we can mark duplicate to this one I think
msg316946 - (view) Author: Gianfranco (locutusofborg) * Date: 2018-05-17 15:15
My first attempt was instead of
to just check for

this avoids when "icc" is the last part of the string, I admit this is not too strong.
Another approach is to use basename with cut -d " " -f 1 to pick just the first parameter, but maybe the best way is to do something like this:

I confirm the "icc-find-v2.patch" works in this way
Date User Action Args
2021-10-19 22:23:37zach.waresetversions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.8
2018-05-19 00:38:23vstinnersetnosy: + vstinner
2018-05-17 15:31:11terry.reedylinkissue33341 superseder
2018-05-17 15:15:57locutusofborgsetfiles: + icc-find-v2.patch

messages: + msg316946
2018-05-17 15:12:34locutusofborgsetfiles: + icc-find.patch
versions: + Python 3.8, - Python 2.7, Python 3.5, Python 3.6, Python 3.7
nosy: + locutusofborg

messages: + msg316944
2016-11-04 15:07:12josh.rsetnosy: + josh.r
messages: + msg280049
2016-11-02 01:47:42zach.waresetnosy: + zach.ware
stage: patch review

versions: - Python 3.3, Python 3.4
2016-11-01 21:44:02strukturedsetversions: + Python 2.7, Python 3.3, Python 3.4
2016-11-01 21:22:46strukturedcreate