[Mesa-dev] [PATCH] gbm: add pthread on libgbm LD_FLAGS

Emil Velikov emil.l.velikov at gmail.com
Tue May 24 08:58:31 UTC 2016


On 24 May 2016 at 09:21, Alejandro PiƱeiro <apinheiro at igalia.com> wrote:
> If not, mesa building fails with the following errors:
> /mesa/src/gbm/../../include/c11/threads_posix.h:189: undefined reference to `pthread_mutexattr_init'
> /mesa/src/gbm/../../include/c11/threads_posix.h:190: undefined reference to `pthread_mutexattr_settype'
> /mesa/source/mesa/src/gbm/../../include/c11/threads_posix.h:192: undefined reference to `pthread_mutexattr_destroy
> ---
>  src/gbm/Makefile.am | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
> index aba8d1e..23a341e 100644
> --- a/src/gbm/Makefile.am
> +++ b/src/gbm/Makefile.am
> @@ -23,7 +23,8 @@ libgbm_la_LDFLAGS = \
>         -no-undefined \
>         -version-info 1:0 \
>         $(GC_SECTIONS) \
> -       $(LD_NO_UNDEFINED)
> +       $(LD_NO_UNDEFINED) \
> +       -pthread
>
Seems like I'm one of the few people building mesa without -O0 ;-) But
seriously: we might end up with another solution, regardless here is
some feedback for future/other projects:

 - Try to avoid hardcoding things - use AX_PTHREAD in configure and
PTHREAD_{CFLAGS,LIBS} in places that need the symbols
 - Do not add -pthread and/or -lfoo into LDFLAGS. These belong in LIBADD/LDADD.

Now I'm off to double-check the alternative solution and get things
building for most people.

Sorry for the breakage all.
Emil


More information about the mesa-dev mailing list