Fix Wayland warning on startup when running X11

On Ubuntu 20.04 running X11, there was this message on every Blender startup:
Unable to find 'wl_proxy_marshal_flags' in 'libwayland-client.so.0'.

The reason is that we build against Wayland protocols 1.21, which in turns requires
Wayland on the distribution to be 1.21+, which is not the case on Ubuntu 20.04.

This simply silences the warning. An improvement would be to explain the user that
their Wayland version is too old when neither X11 or Wayland can be found. Though
that's not trivial and a situation with old Wayland and no XWayland seems unlikely
to happen in practice.

Differential Revision: https://developer.blender.org/D16266
This commit is contained in:
Brecht Van Lommel
2022-11-03 15:46:41 +01:00
committed by Brecht Van Lommel
parent 09b9e1e95e
commit e449bf350c
6 changed files with 15 additions and 8 deletions

View File

@@ -44,7 +44,8 @@ bool wayland_dynload_client_init(const bool verbose)
#define WAYLAND_DYNLOAD_IFACE(symbol) \
{ \
const void *symbol_val; \
if (!(symbol_val = dynamic_library_find_with_error(lib, #symbol, paths[path_found]))) { \
if (!(symbol_val = dynamic_library_find_with_error( \
lib, #symbol, paths[path_found], verbose))) { \
return false; \
} \
memcpy(&symbol, symbol_val, sizeof(symbol)); \
@@ -54,7 +55,7 @@ bool wayland_dynload_client_init(const bool verbose)
#define WAYLAND_DYNLOAD_FN(symbol) \
if (!(wayland_dynload_client.symbol = dynamic_library_find_with_error( \
lib, #symbol, paths[path_found]))) { \
lib, #symbol, paths[path_found], verbose))) { \
return false; \
}
#include "wayland_dynload_client.h"

View File

@@ -36,7 +36,7 @@ bool wayland_dynload_cursor_init(const bool verbose)
#define WAYLAND_DYNLOAD_FN(symbol) \
if (!(wayland_dynload_cursor.symbol = dynamic_library_find_with_error( \
lib, #symbol, paths[path_index]))) { \
lib, #symbol, paths[path_index], verbose))) { \
return false; \
}
#include "wayland_dynload_cursor.h"

View File

@@ -36,7 +36,7 @@ bool wayland_dynload_egl_init(const bool verbose)
#define WAYLAND_DYNLOAD_FN(symbol) \
if (!(wayland_dynload_egl.symbol = dynamic_library_find_with_error( \
lib, #symbol, paths[path_found]))) { \
lib, #symbol, paths[path_found], verbose))) { \
return false; \
}
#include "wayland_dynload_egl.h"

View File

@@ -36,7 +36,7 @@ bool wayland_dynload_libdecor_init(const bool verbose)
#define WAYLAND_DYNLOAD_FN(symbol) \
if (!(wayland_dynload_libdecor.symbol = dynamic_library_find_with_error( \
lib, #symbol, paths[path_index]))) { \
lib, #symbol, paths[path_index], verbose))) { \
return false; \
}
#include "wayland_dynload_libdecor.h"

View File

@@ -30,11 +30,16 @@ DynamicLibrary dynamic_library_open_array_with_error(const char **paths,
return lib;
}
void *dynamic_library_find_with_error(DynamicLibrary lib, const char *symbol, const char *path_lib)
void *dynamic_library_find_with_error(DynamicLibrary lib,
const char *symbol,
const char *path_lib,
const bool verbose)
{
void *symbol_var = dynamic_library_find(lib, symbol);
if (symbol_var == NULL) {
fprintf(stderr, "Unable to find '%s' in '%s'.\n", symbol, path_lib);
if (verbose) {
fprintf(stderr, "Unable to find '%s' in '%s'.\n", symbol, path_lib);
}
}
return symbol_var;
}

View File

@@ -26,4 +26,5 @@ DynamicLibrary dynamic_library_open_array_with_error(const char **paths,
/** Find a symbol, printing an error when the symbol isn't found. */
void *dynamic_library_find_with_error(DynamicLibrary lib,
const char *symbol,
const char *path_lib);
const char *path_lib,
bool verbose);