-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[cling] Anchor the interpreter's clang driver on $ROOTSYS/bin #22754
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1428,6 +1428,23 @@ namespace { | |
| #endif | ||
| // Add host specific includes, -resource-dir if necessary, and -isysroot | ||
| std::string ClingBin = GetExecutablePath(argv[0]); | ||
| #ifdef __linux__ | ||
| // On Linux GetExecutablePath() resolves /proc/self/exe, i.e. the path of | ||
| // the *embedding* application rather than of ROOT/cling itself. clang's | ||
| // driver derives its installed-dir (and hence its GCC-installation and | ||
| // C-system-header sysroot detection) from this path. When libCore is loaded | ||
| // by an executable that does not live next to the ROOT installation, the | ||
| // sysroot is misdetected and the interpreter fails to find the C system | ||
| // headers (e.g. assert.h) even though they are present in the installation. | ||
| // Anchor the driver on $ROOTSYS/bin instead, mirroring how -resource-dir is | ||
| // already made ROOTSYS-relative below. LLVMDir is $ROOTSYS/etc/cling. | ||
| if (LLVMDir) { | ||
| llvm::SmallString<512> rootDriver(LLVMDir); | ||
| llvm::sys::path::append(rootDriver, "..", "..", "bin", "rootcling"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this also work with builtin_cling=OFF or builtin_llvm=OFF ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Conda-forge is only using external clang/llvm. I had to leave before testing the build but I'll definitely test that case.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've confirmed now that this works as expected.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... and for good reason: Cling should remain agnostic of details about the ROOT setup! |
||
| llvm::sys::path::remove_dots(rootDriver, /*remove_dot_dot=*/true); | ||
| ClingBin.assign(rootDriver.data(), rootDriver.size()); | ||
| } | ||
| #endif | ||
| AddHostArguments(ClingBin, argvCompile, LLVMDir, COpts); | ||
|
|
||
| // Be explicit about the stdlib on OS X | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where "below"? The commit message says
TCling, which is not ininterpreter/cling...