[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Build breakage due to missing semaphore.h on z/OS
From: |
Bruno Haible |
Subject: |
Re: Build breakage due to missing semaphore.h on z/OS |
Date: |
Mon, 20 Feb 2017 22:36:28 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-62-generic; KDE/5.18.0; x86_64; ; ) |
Hi Daniel,
> Building current Git on z/OS fails with
>
> source='/u/username/testdir/gltests/test-lock.c' object='test-lock.o'
> libtool=no \
> DEPDIR=.deps depmode=aix /bin/sh /u/username/testdir/build-aux/depcomp \
> xlc-wrap -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I/u/username/testdir/gltests -I..
> -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I.
> -I/u/username/testdir/gltests -I.. -I/u/username/testdir/gltests/..
> -I../gllib -I/u/username/testdir/gltests/../gllib -D_XOPEN_SOURCE=600
> -DNSIG=39 -qhaltonmsg=CCN3296 -g -qfloat=ieee -qlanglvl=extc99 -c -o
> test-lock.o /u/username/testdir/gltests/test-lock.c
> ERROR CCN3296 /u/username/testdir/gltests/test-lock.c:110 #include file
> <semaphore.h> not found.
> ERROR CCN3046 /u/username/testdir/gltests/test-lock.c:147 Syntax error.
> ERROR CCN3278 /u/username/testdir/gltests/test-lock.c:148 The structure
> definition must specify a member list.
> [...]
>
>
> The problem may be found in test-lock.c:
>
> #if USE_POSIX_THREADS
> /* Whether to use a semaphore to communicate information between threads.
> If set to 0, a lock is used. If set to 1, a semaphore is used.
> Uncomment this to reduce the dependencies of this test. */
> # define USE_SEMAPHORE 1
> #endif
>
> ...
>
> #include "glthread/thread.h"
> #include "glthread/yield.h"
> #if USE_SEMAPHORE
> # include <errno.h>
> # include <semaphore.h>
> #endif
>
> $ ls /usr/include/semaphore.h
> ls: FSUM6785 File or directory "/usr/include/semaphore.h" is not found
>
> z/OS has POSIX threads (and pthread.h), but there is no semaphore.h
> header. The sem_*() functions do not appear to exist on this platform.
>
> I worked around this with a quick-and-dirty "#if defined(__MVS__)", but
> a better fix may be to use HAVE_SEMAPHORE_H.
Thanks for the report and explanations. The following patch should fix it.
Pushed.
2017-02-20 Bruno Haible <address@hidden>
lock tests: Fix build failure on z/OS.
Reported by Daniel Richard G. <address@hidden>.
* modules/lock-tests (configure.ac): Test for <semaphore.h>.
* tests/test-lock.c (USE_SEMAPHORE): Don't set if <semaphore.h> does not
exist.
diff --git a/modules/lock-tests b/modules/lock-tests
index b7f1a73..bfab1f4 100644
--- a/modules/lock-tests
+++ b/modules/lock-tests
@@ -8,6 +8,7 @@ usleep
yield
configure.ac:
+AC_CHECK_HEADERS_ONCE([semaphore.h])
Makefile.am:
TESTS += test-rwlock1 test-lock
diff --git a/tests/test-lock.c b/tests/test-lock.c
index f3da4cc..c6bc399 100644
--- a/tests/test-lock.c
+++ b/tests/test-lock.c
@@ -58,7 +58,7 @@
synchronization/communication between different CPUs. */
#define USE_VOLATILE 0
-#if USE_POSIX_THREADS
+#if USE_POSIX_THREADS && HAVE_SEMAPHORE_H
/* Whether to use a semaphore to communicate information between threads.
If set to 0, a lock is used. If set to 1, a semaphore is used.
Uncomment this to reduce the dependencies of this test. */