Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add LD_LIBRARY_PATH to module path (broken commit?)
  • Loading branch information
Teemperor committed Dec 3, 2017
commit 3f508e13f6365be323ffef0bc7f53538b58dc07b
20 changes: 20 additions & 0 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,22 @@ static bool IsFromRootCling() {
return foundSymbol;
}

static void loadModulePath(HeaderSearch& hdrSearch, const char* environmentVariable) {
const char* LD_LIBRARY_PATH = getenv(environmentVariable);
if (LD_LIBRARY_PATH) {
StringRef path = LD_LIBRARY_PATH;
SmallVector<StringRef, 32> paths;
path.split(paths, ":");
for (StringRef path : paths) {
SmallString<128> ModuleMapFilePath = path;
llvm::sys::path::append(ModuleMapFilePath, "module.modulemap");

if (auto file = hdrSearch.getFileMgr().getFile(ModuleMapFilePath))
hdrSearch.loadModuleMapFile(file, false, FileID());
}
}
}

////////////////////////////////////////////////////////////////////////////////
/// Initialize the cling interpreter interface.

Expand Down Expand Up @@ -1251,6 +1267,10 @@ TCling::TCling(const char *name, const char *title)
fMetaProcessor = new cling::MetaProcessor(*fInterpreter, fMPOuts);

if (fInterpreter->getCI()->getLangOpts().Modules) {
HeaderSearch& hdrSearch = fInterpreter->getCI()->getPreprocessor().getHeaderSearchInfo();
hdrSearch.loadTopLevelSystemModules();
loadModulePath(hdrSearch, "LD_LIBRARY_PATH");

// Setup core C++ modules if we have any to setup.
LoadModules({"libc", "stl", "ROOT_Types", "Core", "RIO"}, *fInterpreter);

Expand Down