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

[clang] Updating to include gcc-toolsets 13 and 14 #128438

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

roadswitcher
Copy link

Updating clang/lib/Driver to detect the newer gcc-toolchain versions.

( submitted to llvm-commits mailing list )

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Feb 23, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 23, 2025

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Bill Blum (roadswitcher)

Changes

Updating clang/lib/Driver to detect the newer gcc-toolchain versions.

( submitted to llvm-commits mailing list )


Full diff: https://github.com/llvm/llvm-project/pull/128438.diff

1 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+2)
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index f56eeda3cb5f6..b95fb379f9b0e 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2381,6 +2381,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
       D.getVFS().exists("/opt/rh")) {
     // TODO: We may want to remove this, since the functionality
     //   can be achieved using config files.
+    Prefixes.push_back("/opt/rh/gcc-toolset-14/root/usr");
+    Prefixes.push_back("/opt/rh/gcc-toolset-13/root/usr");
     Prefixes.push_back("/opt/rh/gcc-toolset-12/root/usr");
     Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");
     Prefixes.push_back("/opt/rh/gcc-toolset-10/root/usr");

@MaskRay
Copy link
Member

MaskRay commented Feb 24, 2025

I think redhat gcc-toolset support should move to Clang configuration files https://reviews.llvm.org/D136435 @tbaederr

@nikic
Copy link
Contributor

nikic commented Feb 24, 2025

@MaskRay We already do that, with the following content in the config file:

%if %{defined gts_version}
%global cfg_file_content %{cfg_file_content} --gcc-install-dir=/opt/rh/gcc-toolset-%{gts_version}/root/%{_exec_prefix}/lib/gcc/%{_target_cpu}-redhat-linux/%{gts_version}
%endif

I suspect that this change may be about people building their own clang (not the one RHEL ships) and wanting to use GCC toolset. Would be good to clarify what exactly the motivation is.

Edit: This is in upcoming versions of RHEL. The current releases use -DGCC_INSTALL_PREFIX=/opt/rh/gcc-toolset-%{gts_version}/root/usr instead. I believe that means they also don't depend on the code changed here.

@roadswitcher
Copy link
Author

roadswitcher commented Feb 24, 2025

I suspect that this change may be about people building their own clang (not the one RHEL ships) and wanting to use GCC toolset.

Sorry, I should have been more specific in my original comment.
Yes, we are building LLVM 19 from source along with a number of other tools/libraries and are trying to standardize on using the most recent gcc-toolset available to us in the process.

I didn't see anything obvious in the CMake configuration variables page here ( https://llvm.org/docs/CMake.html ), or any notes under "Compiler Platform Specific Topics" ( https://llvm.org/docs/CMake.html#compiler-platform-specific-topics ).

If there's a preferred way going forwards to specify the GCC toolchain used for the build that's documented in someone's mailing list traffic, I'm happy to pivot this PR into turning mailing list traffic into something for the docs.

@roadswitcher roadswitcher force-pushed the add_newer_gcc_toolsets branch from 6214b24 to a0eb0bc Compare February 24, 2025 16:25
@roadswitcher roadswitcher force-pushed the add_newer_gcc_toolsets branch from a0eb0bc to ed6298c Compare February 24, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants