Skip to content

Commit 4e825ba

Browse files
npmilleromarahmed1111
authored andcommitted
Add dlerror output to loader logs
Failing to load an adapter is not an error in most cases the adapter is just not present. However there's a lot of other reasons why an adapter may fail to load, such as a missing driver library or an unsupported driver. In these cases `dlerror` output is crucial to troubleshoot the issue.
1 parent bd3094c commit 4e825ba

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/common/linux/ur_lib_loader.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ LibLoader::loadAdapterLibrary(const char *name) {
4545
}
4646
#endif
4747
HMODULE handle = dlopen(name, mode);
48-
logger::info("loaded adapter 0x{} ({})", handle, name);
48+
if (!handle) {
49+
char *err = dlerror();
50+
logger::info("failed to load adapter '{}' with error: {}", name,
51+
err ? err : "unknown error");
52+
} else {
53+
logger::info("loaded adapter 0x{} ({})", handle, name);
54+
}
4955
return std::unique_ptr<HMODULE, LibLoader::lib_dtor>(handle);
5056
}
5157

0 commit comments

Comments
 (0)