ref: 14d586ac2f9fa48c86bdc32b60a56e90bf132f73
parent: 6b611d36acab8ce1afdd528599322bb6b2d28727
author: Martin Storsjö <martin@martin.st>
date: Wed Dec 18 05:18:16 EST 2019
Don't assume dlsym exists on linux After checking if -ldl exists, use it for checking for the dlsym function. This fixes building in environments where the dlsym function is unavailable. (My testcase is NDK builds with -static, where dlsym isn't available for static linking, only if linking dynamically.)
--- a/meson.build
+++ b/meson.build
@@ -136,6 +136,9 @@
libdl_dependency = []
if host_machine.system() == 'linux'
libdl_dependency = cc.find_library('dl', required : false)
+ if cc.has_function('dlsym', prefix : '#include <dlfcn.h>', args : test_args, dependencies : libdl_dependency)
+ cdata.set('HAVE_DLSYM', 1)
+ endif
endif
--- a/src/lib.c
+++ b/src/lib.c
@@ -99,7 +99,7 @@
pthread_attr_t thread_attr;
if (pthread_attr_init(&thread_attr)) return DAV1D_ERR(ENOMEM);
size_t stack_size = 1024 * 1024;
-#ifdef __linux__
+#if defined(__linux__) && defined(HAVE_DLSYM)
/* glibc has an issue where the size of the TLS is subtracted from the stack
* size instead of allocated separately. As a result the specified stack
* size may be insufficient when used in an application with large amounts