diff --git a/interpreter/cling/lib/Interpreter/CIFactory.cpp b/interpreter/cling/lib/Interpreter/CIFactory.cpp index 03ad72cb3a4bc..fecd1c746df42 100644 --- a/interpreter/cling/lib/Interpreter/CIFactory.cpp +++ b/interpreter/cling/lib/Interpreter/CIFactory.cpp @@ -380,7 +380,8 @@ namespace { if(arvIt != args.end() && ++arvIt != args.end()) cling_osx_sysroot_directory = *arvIt; if (!llvm::sys::fs::exists(cling_osx_sysroot_directory)) { - if (!::getenv("SDKROOT")) { + auto env = std::getenv("SDKROOT"); + if (!env || !*env) { std::array buffer; const auto xcrun_cmd = "xcrun --show-sdk-path"; std::unique_ptr pipe(