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

gh-96398: Improve accuracy of compiler checks in configure.ac #117815

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Apr 12, 2024

Some checks require a GCC compatible compiler; use $ac_cv_gcc_compat for these.
Some checks require checking the compiler basename; use $CC_BASENAME for these.
For the rest, use $ac_cv_cc_name.

@erlend-aasland
Copy link
Contributor Author

cc. @ronaldoussoren and @ned-deily

@erlend-aasland

This comment was marked as outdated.

@erlend-aasland erlend-aasland marked this pull request as draft April 12, 2024 15:48
@erlend-aasland
Copy link
Contributor Author

erlend-aasland commented Apr 12, 2024

In order to solve the WASI error, I propose to introduce a "GCC compatible" check, and use that as a gate to the compiler flag checks.

UPDATE: proposed in #117825

Introduce a cached variable $ac_cv_gcc_compat and set it to 'yes' if
the C preprocessor defines the __GNUC__ macro.
@erlend-aasland erlend-aasland changed the title gh-96398: Consistently use $ac_cv_cc_name for compiler checks in configure gh-96398: Use $ac_cv_cc_name and $ac_cv_gcc_compat in configure compiler checks Apr 12, 2024
igalic

This comment was marked as resolved.

@erlend-aasland
Copy link
Contributor Author

I'm really happy you're taking this on! One inline question:

@igalic: I did not spot the question; did it get lost when you posted the comment?

@erlend-aasland

This comment was marked as outdated.

configure.ac Show resolved Hide resolved
@corona10

This comment was marked as resolved.

@igalic
Copy link
Contributor

igalic commented Apr 13, 2024

I'm really happy you're taking this on! One inline question:

@igalic: I did not spot the question; did it get lost when you posted the comment?

a less bleary eyed review reveals that I was reading the LTO code wrong. not sure why my question didn't post at all, tho

@erlend-aasland

This comment was marked as resolved.

@@ -1845,7 +1847,7 @@ AC_MSG_RESULT([$PROFILE_TASK])

llvm_bin_dir=''
llvm_path="${PATH}"
if test "${CC}" = "clang"
if test "${ac_cv_cc_name}" = "clang"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using $CC_BASENAME here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC_BASENAME may contain a platform triplet, so ac_cv_cc_name seems better.

For the same reason, when the following code does clang_bin=`which clang`, shouldn't that be clang_bin=$CC?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the same reason, when the following code does clang_bin=`which clang`, shouldn't that be clang_bin=$CC?

I think I'd like to make that change in a follow-up PR.

@erlend-aasland erlend-aasland marked this pull request as ready for review April 13, 2024 21:33
@erlend-aasland erlend-aasland changed the title gh-96398: Use $ac_cv_cc_name and $ac_cv_gcc_compat in configure compiler checks gh-96398: More accurate compiler checks in configure.ac Apr 14, 2024
@erlend-aasland erlend-aasland changed the title gh-96398: More accurate compiler checks in configure.ac gh-96398: Improve accuracy of compiler checks in configure.ac Apr 14, 2024
configure.ac Outdated
Comment on lines 1046 to 1050
case "$CC_BASENAME" in
gcc) AC_PATH_TOOL([CXX], [g++], [g++], [notfound]) ;;
cc) AC_PATH_TOOL([CXX], [c++], [c++], [notfound]) ;;
clang|*/clang) AC_PATH_TOOL([CXX], [clang++], [clang++], [notfound]) ;;
icc|*/icc) AC_PATH_TOOL([CXX], [icpc], [icpc], [notfound]) ;;
clang) AC_PATH_TOOL([CXX], [clang++], [clang++], [notfound]) ;;
icc) AC_PATH_TOOL([CXX], [icpc], [icpc], [notfound]) ;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to correspond to the definition of AC_PATH_TOOL:

AC_PATH_TOOL (variable, prog-to-check-for, [value-if-not-found], [path = ‘$PATH’])

  • variable = CXX
  • prog-to-check-for = g++
  • value-if-not-found = g++ (?)
  • path = notfound (??)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, CC_BASENAME may contain a platform triplet, so shouldn't this use ac_cv_cc_name instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, CC_BASENAME may contain a platform triplet, so shouldn't this use ac_cv_cc_name instead?

Yes, this should use ac_cv_cc_name, not CC_BASENAME.

This doesn't seem to correspond to the definition of AC_PATH_TOOL:

Indeed; I suggest we look at this in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, CC_BASENAME may contain a platform triplet, so shouldn't this use ac_cv_cc_name instead?

Addressed with 9900633.

@freakboy3742
Copy link
Contributor

FWIW: @mhsmith pinged me on this PR, because of the potential for clash with the iOS compiler shims (around L400 of configure.ac). I've confirmed that iOS builds still work with these changes.

@erlend-aasland erlend-aasland added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 14, 2024
@bedevere-bot

This comment was marked as outdated.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 14, 2024
@erlend-aasland
Copy link
Contributor Author

It seems there are refleaks on main. I'll wait for them to be resolved and do another buildbot run, just to make sure.

In the mean time, feel free to take another look, if needed.

@erlend-aasland erlend-aasland added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 28, 2024
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @erlend-aasland for commit d309996 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 28, 2024
@erlend-aasland erlend-aasland added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 29, 2024
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @erlend-aasland for commit 9900633 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants