Commit d6d97dad authored by Arnaud Vrac's avatar Arnaud Vrac Committed by Quentin Glidic fix linking when using compiler sanitizers

The GCC address sanitizer overrides dlopen and dlclose, so the configure
test does not detect libdl as a needed dependency for linking. It is
still needed though, as dlsym is not exported by the sanitizer. The
result is that linking fails in the end.

Fix this by checking for dlsym instead of dlopen.

This can be reproduced by configuring the build with:
CFLAGS="-fsanitize=address -fsanitize=undefined"
LDFLAGS="-fsanitize=address -fsanitize=undefined"
Signed-off-by: Arnaud Vrac's avatarArnaud Vrac <>
Reviewed-by: Quentin Glidic's avatarQuentin Glidic <>
parent 7b5fe9b0
......@@ -74,7 +74,7 @@ libweston_@LIBWESTON_MAJOR@_la_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON
libweston_@LIBWESTON_MAJOR@_la_LDFLAGS = -version-info $(LT_VERSION_INFO)
......@@ -194,7 +194,7 @@ weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON \
weston_LDADD = \
......@@ -86,7 +86,8 @@ AC_ARG_VAR([WESTON_SHELL_CLIENT],
WESTON_SEARCH_LIBS([DLOPEN], [dl], [dlopen])
# Check for dlsym instead of dlopen because ASAN hijacks the latter
WESTON_SEARCH_LIBS([DL], [dl], [dlsym])
# In old glibc versions (< 2.17) clock_gettime() and clock_getres() are in librt
WESTON_SEARCH_LIBS([CLOCK_GETTIME], [rt], [clock_gettime])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment