Don't try using /usr/lib/libc.so on unknown Unix systems

This doesn't work under FreeBSD, even if the file exists there.

Show the existing libc candidates on such systems to see if any of them
look plausible.
This commit is contained in:
Vadim Zeitlin 2022-06-30 14:03:44 +02:00
parent 587c1fafe0
commit 20c8844925

View File

@ -15,6 +15,7 @@
#include "wx/dynlib.h"
#ifndef __WINDOWS__
#include "wx/dir.h"
#include "wx/filename.h"
#endif
@ -37,8 +38,7 @@ TEST_CASE("DynamicLibrary::Load", "[dynlib]")
static const char* const LIB_NAME = "/lib/libc.so.6";
#endif
#else
// Try some generic fallback.
static const char* const LIB_NAME = "/usr/lib/libc.so";
static const char* const LIB_NAME = "/unknown/libc/location";
#endif
static const char* const FUNC_NAME = "strlen";
@ -49,6 +49,15 @@ TEST_CASE("DynamicLibrary::Load", "[dynlib]")
{
WARN("Shared library \"" << LIB_NAME << "\" doesn't exist, "
"skipping DynamicLibraryTestCase::Load() test.");
wxArrayString paths;
wxDir::GetAllFiles("/lib", &paths, "libc.*", wxDIR_FILES);
wxDir::GetAllFiles("/usr/lib", &paths, "libc.*", wxDIR_FILES);
if ( !paths.empty() )
{
WARN("Possible candidates:\n" << wxJoin(paths, '\n'));
}
return;
}
#endif // !__DARWIN__