[PATCH 0/1] MR10876: wine: Show all dlopen() error messages instead of just the last one.
I ran into this multiple times while working on arm64 builds, and the actually useful error is always one of the first ones, not the last one. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10876
From: Sven Baars <sbaars@codeweavers.com> --- tools/wine/wine.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/wine/wine.c b/tools/wine/wine.c index ea756088cf8..cb2e439c3b2 100644 --- a/tools/wine/wine.c +++ b/tools/wine/wine.c @@ -30,25 +30,33 @@ static const char *libdir; static void *load_ntdll(void) { const char *arch_dir = get_arch_dir( get_default_target() ); - struct strarray dllpath; + struct strarray dllpath, errors = { 0 }; void *handle; - if (bindir && strendswith( bindir, "/tools/wine" ) && - ((handle = dlopen( strmake( "%s/../../dlls/ntdll/ntdll.so", bindir ), RTLD_NOW )))) - return handle; + if (bindir && strendswith( bindir, "/tools/wine" )) + { + if ((handle = dlopen( strmake( "%s/../../dlls/ntdll/ntdll.so", bindir ), RTLD_NOW ))) + return handle; + strarray_add( &errors, xstrdup( dlerror() ) ); + } if ((handle = dlopen( strmake( "%s/wine%s/ntdll.so", libdir, arch_dir ), RTLD_NOW ))) return handle; + strarray_add( &errors, xstrdup( dlerror() ) ); dllpath = strarray_frompath( getenv( "WINEDLLPATH" )); STRARRAY_FOR_EACH( dir, &dllpath ) { if ((handle = dlopen( strmake( "%s%s/ntdll.so", dir, arch_dir ), RTLD_NOW ))) return handle; + strarray_add( &errors, xstrdup( dlerror() ) ); + if ((handle = dlopen( strmake( "%s/ntdll.so", dir ), RTLD_NOW ))) return handle; + strarray_add( &errors, xstrdup( dlerror() ) ); } - fprintf( stderr, "wine: could not load ntdll.so: %s\n", dlerror() ); + fprintf( stderr, "wine: could not load ntdll.so:\n" ); + STRARRAY_FOR_EACH( error, &errors ) fprintf( stderr, " %s\n", error ); exit(1); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10876
Having a dlopen wrapper that appends dlerror() on error would be nice. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10876#note_139590
participants (3)
-
Jinoh Kang (@iamahuman) -
Sven Baars -
Sven Baars (@sbaars)