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 authored and vgvassilev committed Mar 11, 2018
commit ad48d79a450b488ecf4f31f7d6af12d8c286547d
20 changes: 20 additions & 0 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,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 @@ -1253,6 +1269,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.

// Load libc and stl first.
Expand Down