Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure.ac: using $CC to check compiler names may result in erroneous judgements #96398

Closed
kanavin opened this issue Aug 29, 2022 · 6 comments
Assignees
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@kanavin
Copy link
Contributor

kanavin commented Aug 29, 2022

configure.ac contains multiple checks of this kind:

case $CC in

When paths contain "clang"/"gcc"/"icc", they might be part of $CC
for example because of the "--sysroot" parameter. That could cause
judgement error about clang/gcc/icc compilers. e.g.

when "icc" is containded in working path, below errors are reported when compiling python3:

x86_64-wrs-linux-gcc: error: strict: No such file or directory
x86_64-wrs-linux-gcc: error: unrecognized command line option '-fp-model'

Linked PRs

@tiran
Copy link
Member

tiran commented Aug 29, 2022

We are aware that the checks are problematic have already plans to replace $CC checks with $ac_cv_cc_name. It's a new variable that I introduced a short while ago.

@tiran
Copy link
Member

tiran commented Aug 29, 2022

CC @erlend-aasland @mdboom

@erlend-aasland
Copy link
Contributor

cc. @corona10

@erlend-aasland
Copy link
Contributor

A quick summary:

#110034 points out that we've got various attempts to detect the compiler version in configure. There's the $CC variable, there's $cc_is_clang, $ac_cv_cc_name, and $GCC. All four of them are used.

#110577 points out that the compiler selection check on macOS is at least partly obsolete. Perhaps that issue deserves to be re-opened and investigated on its own.

$ac_cv_cc_name was introduced by Christian in 3124d9a (PR: #93492, issue: #93491).

@erlend-aasland
Copy link
Contributor

#117815 adapts most relevant checks to use $ac_cv_cc_name. Reviews welcome!

erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Apr 12, 2024
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Apr 12, 2024
erlend-aasland added a commit that referenced this issue Apr 12, 2024
- emcc defines __EMSCRIPTEN__
- mpicc doesn't define anything in particular; detect it using basename
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Apr 12, 2024
Introduce a cached variable $ac_cv_gcc_compat and set it to 'yes' if
the C preprocessor defines the __GNUC__ macro.
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Apr 12, 2024
Introduce a cached variable $ac_cv_gcc_compat and set it to 'yes' if
the C preprocessor defines the __GNUC__ macro.
erlend-aasland added a commit that referenced this issue Apr 13, 2024
Introduce a cached variable $ac_cv_gcc_compat and set it to 'yes' if
the C preprocessor defines the __GNUC__ macro.
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Apr 13, 2024
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Apr 13, 2024
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Apr 13, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
…ython#117819)

- emcc defines __EMSCRIPTEN__
- mpicc doesn't define anything in particular; detect it using basename
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
…117825)

Introduce a cached variable $ac_cv_gcc_compat and set it to 'yes' if
the C preprocessor defines the __GNUC__ macro.
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
erlend-aasland added a commit that referenced this issue Nov 7, 2024
The following variables are now used in compiler checks:
- $ac_cv_gcc_compat is set to 'yes' for GCC compatible compilers
  (the C preprocessor defines the __GNUC__ macro)
- for compiler basename checks, use $CC_BASENAME
  (may contain platform triplets)
- for the rest, use $ac_cv_cc_name
  (does not contain platform triplets)
@erlend-aasland
Copy link
Contributor

This should now be resolved. Please shout out if you still encounter problems.

picnixz pushed a commit to picnixz/cpython that referenced this issue Dec 8, 2024
…ython#117815)

The following variables are now used in compiler checks:
- $ac_cv_gcc_compat is set to 'yes' for GCC compatible compilers
  (the C preprocessor defines the __GNUC__ macro)
- for compiler basename checks, use $CC_BASENAME
  (may contain platform triplets)
- for the rest, use $ac_cv_cc_name
  (does not contain platform triplets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants