[Mesa-dev] [PATCH 2/4] configure.ac: remove explicit -lpthread link

Rowley, Timothy O timothy.o.rowley at intel.com
Fri Jun 9 13:16:12 UTC 2017


With this patch series applied, the build fails for me on ubuntu 16.04.

Tree configured thusly:

../mesa/configure --with-platforms=x11 --disable-gbm --disable-egl --disable-dri --disable-xvmc --disable-vdpau --disable-omx --disable-va --with-gallium-drivers=swrast,swr LLVM_CONFIG=/home/torowley/llvm-3.9.0-opt/bin/llvm-config

Error:

make[5]: Entering directory '/home/torowley/work/mesa-opt/src/util'
  CC       libmesautil_la-u_atomic.lo
  CC       libmesautil_la-u_queue.lo
In file included from ../../../mesa/src/util/u_thread.h:32:0,
                 from ../../../mesa/src/util/u_queue.h:39,
                 from ../../../mesa/src/util/u_queue.c:27:
../../../mesa/include/c11/threads.h:79:2: error: #error Not supported on this platform.
 #error Not supported on this platform.
  ^
In file included from ../../../mesa/src/util/u_queue.h:39:0,
                 from ../../../mesa/src/util/u_queue.c:27:
../../../mesa/src/util/u_thread.h:39:15: error: unknown type name ‘thrd_t’
 static inline thrd_t u_thread_create(int (*routine)(void *), void *param)
               ^
../../../mesa/src/util/u_thread.h: In function ‘u_thread_create’:
../../../mesa/src/util/u_thread.h:41:4: error: unknown type name ‘thrd_t’
    thrd_t thread;
    ^
../../../mesa/src/util/u_thread.h:52:10: error: implicit declaration of function ‘thrd_create’ [-Werror=implicit-function-declaration]
    ret = thrd_create( &thread, routine, param );
          ^
...

On Jun 9, 2017, at 5:42 AM, Emil Velikov <emil.l.velikov at gmail.com<mailto:emil.l.velikov at gmail.com>> wrote:

Hi all,

On 5 June 2017 at 00:04, Emil Velikov <emil.l.velikov at gmail.com<mailto:emil.l.velikov at gmail.com>> wrote:
From: Emil Velikov <emil.velikov at collabora.com<mailto:emil.velikov at collabora.com>>

As mentioned in last commit - pthread manual suggests using -pthread.
Furthermore, to the best of my knowledge anything built with GCC and
Clang should just work (tm) with the said flag.

AFAICT using the Sun or Intel compiler may need special treatment, but
that is to be confirmed/dismissed.

Cc: Randy Fishel <randy.fishel at oracle.com<mailto:randy.fishel at oracle.com>>
Cc: Niveditha Rau <niveditha.rau at oracle.com<mailto:niveditha.rau at oracle.com>>
Cc: Jon Turney <jon.turney at dronecode.org.uk<mailto:jon.turney at dronecode.org.uk>>
Cc: Tim Rowley <timothy.o.rowley at intel.com<mailto:timothy.o.rowley at intel.com>>
Cc: Bruce Cherniak <bruce.cherniak at intel.com<mailto:bruce.cherniak at intel.com>>
Cc: Jeremy Huddleston Sequoia <jeremyhu at apple.com<mailto:jeremyhu at apple.com>>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com<mailto:emil.l.velikov at gmail.com>>
---
Ladies and gents,

Please confirm if "-pthread" works on your platform/compiler combos.
If fixup changes are needed, please send over a patch to squash.

Thanks
Emil
---
configure.ac     |  15 +--
m4/ax_pthread.m4 | 309 -------------------------------------------------------
2 files changed, 2 insertions(+), 322 deletions(-)
delete mode 100644 m4/ax_pthread.m4

diff --git a/configure.ac b/configure.ac
index 1c15eb482f9..2e4264cf592 100644
--- a/configure.ac
+++ b/configure.ac
@@ -825,23 +825,12 @@ AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
dnl Check for zlib
PKG_CHECK_MODULES([ZLIB], [zlib >= $ZLIB_REQUIRED])

-dnl Check for pthreads
-AX_PTHREAD
-if test "x$ax_pthread_ok" = xno; then
-    AC_MSG_ERROR([Building mesa on this platform requires pthreads])
-fi
-dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
-dnl to -pthread, which causes problems if we need -lpthread to appear in
-dnl pkgconfig files.  Since Android doesn't have a pthread lib, this check
-dnl is not valid for that platform.
-if test "x$android" = xno; then
-    test -z "$PTHREAD_LIBS" && PTHREAD_LIBS="-lpthread"
-fi
dnl According to the manual when using pthreads, one should add -pthread to
dnl both compile and link-time arguments.
dnl In practise that should be sufficient for all platforms, since any
dnl platforms build with GCC and Clang support the flag.
-PTHREAD_LIBS="$PTHREAD_LIBS -pthread"
+PTHREAD_CFLAGS="-pthread"
+PTHREAD_LIBS="-pthread"

Humble ping? Anyone's testing would be appreciated, although I would
love to hear from anyone in the CC-chain.

If the commit message seems sparse/ambiguous or in general you think
more information is needed, please let me know.
I intentionally, tried to keep it concise although it might have gone too brief.

Thanks
Emil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170609/e4d67c22/attachment-0001.html>


More information about the mesa-dev mailing list