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 ability to infer CHPL_LLVM_GCC_INSTALL_DIR #26429

Merged
merged 7 commits into from
Jan 6, 2025

Conversation

jabraham17
Copy link
Member

@jabraham17 jabraham17 commented Dec 17, 2024

Adds the ability to infer CHPL_LLVM_GCC_INSTALL_DIR. Resolves #25925

This PR uses similar logic to the LLVM spack package to determine this. Thanks @PHHargrove for the pointer to this.

Testing

  • A system with a "broken" clang can fix itself automatically now
    • relatedly, a user can request no gcc install dir with CHPL_LLVM_GCC_INSTALL_DIR=none
  • make check on a nightly test system
  • full paratest with/without gasnet on linux64
  • make check on M1 mac
  • Setting GCC_INSTALL_DIR or GCC_PREFIX turns off inference
  • Setting both GCC_INSTALL_DIR and GCC_PREFIX warns, then prefers GCC_INSTALL_DIR if available
  • If supported, GCC_INSTALL_DIR is preferred (unless user requests otherwise)

This PR also adds a missing line to overrides.py for CHPL_LLVM_GCC_INSTALL_DIR

[Reviewed by @mppf]

@jabraham17 jabraham17 force-pushed the infer-gcc-install-dir branch from 112be91 to 19f598f Compare December 18, 2024 00:04
@jabraham17 jabraham17 requested a review from mppf December 18, 2024 00:07
Copy link
Member

@mppf mppf left a comment

Choose a reason for hiding this comment

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

I would assume that we want this to replace the by-default inference in get_gcc_prefix_dir. That is, if LLVM version is new enough, we should infer CHPL_LLVM_GCC_INSTALL_DIR but not CHPL_LLVM_GCC_PREFIX. If LLVM is too old, we should infer CHPL_LLVM_GCC_PREFIX but not CHPL_LLVM_GCC_INSTALL_DIR.

Also, presumably, we want to infer neither of these if one of them is set in the environment.

util/chplenv/chpl_llvm.py Outdated Show resolved Hide resolved
util/chplenv/overrides.py Show resolved Hide resolved
Signed-off-by: Jade Abraham <[email protected]>
@jabraham17
Copy link
Member Author

I would assume that we want this to replace the by-default inference in get_gcc_prefix_dir. That is, if LLVM version is new enough, we should infer CHPL_LLVM_GCC_INSTALL_DIR but not CHPL_LLVM_GCC_PREFIX. If LLVM is too old, we should infer CHPL_LLVM_GCC_PREFIX but not CHPL_LLVM_GCC_INSTALL_DIR

That should be the logic already. This PR didn't touch the existing logic, which already prefers GCC_INSTALL_DIR

    gcc_install_dir = get_gcc_install_dir()
    if gcc_install_dir:
        clang_args.append('--gcc-install-dir=' + gcc_install_dir)
    else:
        gcc_prefix = get_gcc_prefix_dir(clang_cfg_args)
        if gcc_prefix:
            clang_args.append('--gcc-toolchain=' + gcc_prefix)

Also, presumably, we want to infer neither of these if one of them is set in the environment.

This is currently not handled. Also, if both are specified I expect we would want to prefer GCC_INSTALL_DIR and warn about GCC_PREFIX being set. I will make add this

util/chplenv/chpl_llvm.py Outdated Show resolved Hide resolved
Signed-off-by: Jade Abraham <[email protected]>
@jabraham17 jabraham17 merged commit ce20881 into chapel-lang:main Jan 6, 2025
8 checks passed
@jabraham17 jabraham17 deleted the infer-gcc-install-dir branch January 6, 2025 18:15
@bradcray
Copy link
Member

bradcray commented Jan 6, 2025

Ooh, exciting!

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.

Should we automatically infer CHPL_LLVM_GCC_INSTALL_DIR?
3 participants