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 CHPL_LLVM=bundled build when a system LLVM is installed #26402

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

jabraham17
Copy link
Member

@jabraham17 jabraham17 commented Dec 13, 2024

Fixes an issue where having a system install of LLVM could prevent compiler builds with CHPL_LLVM=bundled.

This issue occurs when a system install of LLVM is in the normal C system includes, but then we treat our bundled LLVM as a system include. Since we were treating our bundled LLVM as a system include (added at the end of the list), the system LLVM headers were being erroneously used by the compiler.

The solution is to add bundled LLVM headers as system includes, but add them to the front of the list instead of the end.

Related previous PR: #26212

[Reviewed by @mppf]

Signed-off-by: Jade Abraham <[email protected]>
@jabraham17 jabraham17 requested a review from mppf December 13, 2024 17:01
@jabraham17 jabraham17 merged commit 854aa74 into chapel-lang:main Dec 16, 2024
7 checks passed
@jabraham17 jabraham17 deleted the bundled-with-system branch December 16, 2024 15:54
jabraham17 added a commit that referenced this pull request Jan 6, 2025
…#26428)

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
- [x] `make check` with HOST_CC=clang, LLVM=system
- [x] `make check` with HOST_CC=clang, LLVM=bundled
- [x] `make check` with HOST_CC=clang, LLVM=system,
LLVM_CONFIG=/some/path, with/without a normal system LLVM
- [x] `make check` with HOST_CC=gnu, LLVM=system
- [x] `make check` with HOST_CC=gnu, LLVM=bundled
- [x] `make check` with HOST_CC=gnu, LLVM=system,
LLVM_CONFIG=/some/path, with/without a normal system LLVM
- [x] Sanity check that normal compilations on Mac are not broken

[Reviewed by @mppf]
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.

2 participants