Skip to content

Do not probe /bin/clang for the resource dir with a build-tree Clang - #1155

Open
conrade-ctc wants to merge 1 commit into
compiler-research:mainfrom
chicagotrading:fix/resource-dir-build-tree
Open

conrade-ctc wants to merge 1 commit into
compiler-research:mainfrom
chicagotrading:fix/resource-dir-build-tree

Conversation

@conrade-ctc

Copy link
Copy Markdown
Collaborator

Description

A build-tree ClangConfig.cmake does not set CLANG_INSTALL_PREFIX. Thus the configure-time probe from #1119 runs /bin/clang -print-resource-dir. On a host with a system clang, the library then gets that clang's resource dir, also when its major version is different. For example, a library for LLVM 22 used /usr/lib/clang/21, and Interpreter_DetectResourceDir failed.

This skips the probe when CLANG_INSTALL_PREFIX is empty, as the prefix fallback from #1143 already does. A build-tree build then compiles in no resource dir, and at runtime MakeResourcesPath() finds it through LLVM_BINARY_DIR.

Type of change

  • Bug fix
  • New feature
  • Requires documentation updates

Testing

Locally (Linux, an LLVM 22 build tree, a system clang 21 in /usr/bin), the configure step now shows no detected dir, and all unit tests pass, Interpreter_DetectResourceDir included. Before the change, that test failed in the in-process and out-of-process modes.

Checklist

  • I have read the contribution guide recently

🤖 Done with the help of Claude Code (Opus 5.5, human in the loop)

@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.86%. Comparing base (3ab124a) to head (339c4a6).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1155   +/-   ##
=======================================
  Coverage   88.86%   88.86%           
=======================================
  Files          24       24           
  Lines        7014     7014           
=======================================
  Hits         6233     6233           
  Misses        781      781           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

A build-tree ClangConfig does not set CLANG_INSTALL_PREFIX, so the
configure-time probe ran /bin/clang. On a host with a system clang, the
library then used that clang's resource dir, also for another major
version. Skip the probe without a prefix; the runtime finds the dir
through LLVM_BINARY_DIR.

Co-developed-with-the-help-of: Claude Code (Opus 5.5, human in the loop)
@conrade-ctc
conrade-ctc force-pushed the fix/resource-dir-build-tree branch from 10f1f68 to 339c4a6 Compare November 30, 2026 22:08

This branch has not been deployed

No deployments
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.

1 participant