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

Fix issues with using a non-default system LLVM with CHPL_LLVM_CONFIG #26428

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

Conversation

jabraham17
Copy link
Member

@jabraham17 jabraham17 commented Dec 17, 2024

Fixes compiler build issues when using a system LLVM that is different than the standard LLVM. For example, an LLVM installed at /usr/ would conflict with an LLVM installed at /home/user/llvm-install (which was accessed by CHPL_LLVM_CONFIG=/home/user/llvm-install)

Subsumes #26212 and #26402

Previous work had tried to take advantage of various clang/gcc flags to achieve the right behavior, however this not working in all cases. This PR does following.

  1. computes the existing search paths for the compiler
  2. for each LLVM include directory specified as -I
  • In a bundled LLVM build: always use '-isystem'
  • In a system LLVM build: use '-isystem' if its not an existing search path, otherwise use '-I'

Testing

  • make check with HOST_CC=clang, LLVM=system
  • make check with HOST_CC=clang, LLVM=bundled
  • make check with HOST_CC=clang, LLVM=system, LLVM_CONFIG=/some/path, with/without a normal system LLVM
  • make check with HOST_CC=gnu, LLVM=system
  • make check with HOST_CC=gnu, LLVM=bundled
  • make check with HOST_CC=gnu, LLVM=system, LLVM_CONFIG=/some/path, with/without a normal system LLVM
  • Sanity check that normal compilations on Mac are not broken

@jabraham17 jabraham17 requested a review from mppf December 17, 2024 23:01
@jabraham17 jabraham17 changed the title Fix issues with using a non-default systen LLVM with CHPL_LLVM_CONFIG Fix issues with using a non-default system LLVM with CHPL_LLVM_CONFIG Dec 18, 2024
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'm happy with it if you add a check for clang/gcc

@@ -1024,6 +1024,42 @@ def get_clang_prgenv_args():

return (comp_args, link_args)

@memoize
def get_system_include_directories(flag, lang):
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure this code will only work for gcc and clang. I'd recommend limiting it to those compilers. We can add other compilers as needed.

ret.append('-isystem' + directory)
else:
# technically don't need to add this for
# but it's harmless to use -I
Copy link
Member

Choose a reason for hiding this comment

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

comment wording got weird

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