From 2fe77c47e174e24ffa388b438448f0589f4662ae Mon Sep 17 00:00:00 2001 From: Carlos Rafael Giani Date: Tue, 20 May 2025 11:55:30 +0200 Subject: [PATCH] spa: tools: spa-inspect: Output more detailed dlopen and dlsym errors When writing a custom SPA plugin, it is very useful to get more detailed errors related to libdl. One common error is that a symbol is not present because a related library was not properly linked into the plugin. With this change, the error will tell the user about the exact missing symbol. --- spa/tools/spa-inspect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spa/tools/spa-inspect.c b/spa/tools/spa-inspect.c index fd562b5f0..dd3ff752f 100644 --- a/spa/tools/spa-inspect.c +++ b/spa/tools/spa-inspect.c @@ -277,11 +277,11 @@ int main(int argc, char *argv[]) data.n_support = 3; if ((handle = dlopen(argv[1], RTLD_NOW)) == NULL) { - printf("can't load %s\n", argv[1]); + printf("can't load %s: %s\n", argv[1], dlerror()); return -1; } if ((enum_func = dlsym(handle, SPA_HANDLE_FACTORY_ENUM_FUNC_NAME)) == NULL) { - printf("can't find function\n"); + printf("can't find \"%s\" function: %s\n", SPA_HANDLE_FACTORY_ENUM_FUNC_NAME, dlerror()); return -1; }