diff --git a/llvm/lib/Analysis/ACPOMLInterface.cpp b/llvm/lib/Analysis/ACPOMLInterface.cpp index f48eb46638e3e06ced371635d474cdbd9b3d6734..7d84bd5112d6dbd17872c9db0a03955c99ac36c5 100644 --- a/llvm/lib/Analysis/ACPOMLInterface.cpp +++ b/llvm/lib/Analysis/ACPOMLInterface.cpp @@ -146,7 +146,15 @@ ACPOMLPythonInterface::ACPOMLPythonInterface() : NextID{0} { } int32_t PID = (int32_t) llvm::sys::Process::getProcessId(); - std::string ExecPython = "/usr/bin/python3"; + std::string ExecPython; + llvm::ErrorOr Res = llvm::sys::findProgramByName("python3"); + if (std::error_code EC = Res.getError()) { + LLVM_DEBUG(dbgs() << "python3 could not be found, error_code " << EC.value() << "\n"); + return; + } else { + ExecPython = Res.get(); + LLVM_DEBUG(dbgs() << "python3 version found in " << ExecPython << "\n"); + } std::string PythonScript = *Env + "/" + std::string(ACPO_ML_PYTHON_INTERFACE_PY); std::string PIDStr = std::to_string(PID);