diff --git a/openmp/runtime/src/ompt-general.cpp b/openmp/runtime/src/ompt-general.cpp --- a/openmp/runtime/src/ompt-general.cpp +++ b/openmp/runtime/src/ompt-general.cpp @@ -346,9 +346,16 @@ OMPT_VERBOSE_INIT_CONTINUED_PRINT("Success. \n"); OMPT_VERBOSE_INIT_PRINT("Searching for ompt_start_tool in %s... ", fname); + dlerror(); // Clear any existing error start_tool = (ompt_start_tool_t)dlsym(h, "ompt_start_tool"); if (!start_tool) { - OMPT_VERBOSE_INIT_CONTINUED_PRINT("Failed: %s\n", dlerror()); + char *error = dlerror(); + if (error != NULL) { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Failed: %s\n", error); + } else { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Failed: %s\n", + "ompt_start_tool = NULL"); + } } else #elif KMP_OS_WINDOWS OMPT_VERBOSE_INIT_PRINT("Opening %s... ", fname);