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

Add CHPL_LLVM_GCC_INSTALL_DIR as an alternative to CHPL_LLVM_GCC_PREFIX #25913

Merged
merged 5 commits into from
Sep 10, 2024

Conversation

mppf
Copy link
Member

@mppf mppf commented Sep 9, 2024

This PR adds CHPL_LLVM_GCC_INSTALL_DIR as an alternative to CHPL_LLVM_GCC_PREFIX.

This PR is motivated by the discussion in https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/12 .

CHPL_LLVM_GCC_PREFIX allows one to select a GCC installation. The trouble is, on some systems (E.g. Ubuntu 24.04), there can be multiple versions of GCC installed at the same time, with the same prefix (/usr in this case).

clang actually supports --gcc-install-dir as of clang 16. That flag can be used to request a particular version of GCC on Ubuntu.

To understand what one might want to include:

  • run clang++ -v hello.cc where hello.cc might just contain int main() { return 0; }
  • you can see the GCC installations it considers at the beginning, e.g.
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/14
    Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/14
    
  • you can try to change which version should be used, e.g. with clang++ -v hello.cc --gcc-install-dir=/usr/bin/../lib/gcc/x86_64-linux-gnu/13

Reviewed by @e-kayrakli - thanks!

  • able to build a GPU-enabled runtime on Ubuntu 24.04 with GCC 14 installed
  • full comm=none testing

@mppf mppf requested a review from e-kayrakli September 9, 2024 21:08
Copy link
Contributor

@e-kayrakli e-kayrakli left a comment

Choose a reason for hiding this comment

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

Should we ignore the environment variable for clangs that don't support the flag that we use? (clang <16, I think?)

---
Signed-off-by: Michael Ferguson <[email protected]>
---
Signed-off-by: Michael Ferguson <[email protected]>
---
Signed-off-by: Michael Ferguson <[email protected]>
Copy link
Contributor

@e-kayrakli e-kayrakli left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@mppf mppf merged commit 943c49c into chapel-lang:main Sep 10, 2024
7 checks passed
@mppf mppf deleted the add-way-to-request-gcc-install-dir branch September 10, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants