Page MenuHome GnuPG

npth-1.6: error: unknown type name ‘pthread_rwlock_t’
Closed, ResolvedPublic

Description

Hello,

I'm trying to compile npth on a sparc machine which fails with:

make
make  all-recursive
make[1]: Entering directory '/c/backup/fes-readynasduo/npth-1.6'
Making all in src
make[2]: Entering directory '/c/backup/fes-readynasduo/npth-1.6/src'
/bin/sh ../libtool  --tag=CC   --mode=compile /opt/gcc-7.1/bin/gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -MT npth.lo -MD -MP -MF .deps/npth.Tpo -c -o npth.lo npth.c
libtool: compile:  /opt/gcc-7.1/bin/gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT npth.lo -MD -MP -MF .deps/npth.Tpo -c npth.c  -fPIC -DPIC -o .libs/npth.o
mv -f .deps/npth.Tpo .deps/npth.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile /opt/gcc-7.1/bin/gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -MT npth-sigev.lo -MD -MP -MF .deps/npth-sigev.Tpo -c -o npth-sigev.lo npth-sigev.c
libtool: compile:  /opt/gcc-7.1/bin/gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT npth-sigev.lo -MD -MP -MF .deps/npth-sigev.Tpo -c npth-sigev.c  -fPIC -DPIC -o .libs/npth-sigev.o
mv -f .deps/npth-sigev.Tpo .deps/npth-sigev.Plo
/bin/sh ../libtool  --tag=CC   --mode=link /opt/gcc-7.1/bin/gcc  -g -O2   -Wl,--version-script=./libnpth.vers -version-info 1:2:1  -o libnpth.la -rpath /usr/local/lib npth.lo npth-sigev.lo  -lpthread
libtool: link: /opt/gcc-7.1/bin/gcc -shared  -fPIC -DPIC  .libs/npth.o .libs/npth-sigev.o   -lpthread  -O2 -Wl,--version-script=./libnpth.vers   -Wl,-soname -Wl,libnpth.so.0 -o .libs/libnpth.so.0.1.2
libtool: link: (cd ".libs" && rm -f "libnpth.so.0" && ln -s "libnpth.so.0.1.2" "libnpth.so.0")
libtool: link: (cd ".libs" && rm -f "libnpth.so" && ln -s "libnpth.so.0.1.2" "libnpth.so")
libtool: link: ( cd ".libs" && rm -f "libnpth.la" && ln -s "../libnpth.la" "libnpth.la" )
make[2]: Leaving directory '/c/backup/fes-readynasduo/npth-1.6/src'
Making all in tests
make[2]: Entering directory '/c/backup/fes-readynasduo/npth-1.6/tests'
/opt/gcc-7.1/bin/gcc -DHAVE_CONFIG_H -I. -I..  -I../src -D_POSIX_C_SOURCE=200112L   -g -O2 -MT t-mutex.o -MD -MP -MF .deps/t-mutex.Tpo -c -o t-mutex.o t-mutex.c
In file included from t-support.h:18:0,
                 from t-mutex.c:13:
../src/npth.h:270:9: error: unknown type name ‘pthread_rwlock_t’
 typedef pthread_rwlock_t npth_rwlock_t;
         ^~~~~~~~~~~~~~~~
make[2]: *** [Makefile:451: t-mutex.o] Error 1
make[2]: Leaving directory '/c/backup/fes-readynasduo/npth-1.6/tests'
make[1]: *** [Makefile:537: all-recursive] Error 1
make[1]: Leaving directory '/c/backup/fes-readynasduo/npth-1.6'
make: *** [Makefile:410: all] Error 2

I checked my pthread.h in usr/include/pthread.h and for me it looks like pthread_rwlock_t is defined somewhere else. Can someone give me a hint how to fix this?

I uploaded the complete build directory to github - see external link.

Any help appreciated. Thanks

Details

External Link
https://github.com/mfe-/npt
Version
1.6

Revisions and Commits

Event Timeline

werner added subscribers: gniibe, werner.

Hello @gniibe, you did the last work on nPTh. Would you be so kind and look into this?

gniibe triaged this task as Normal priority.EditedOct 20 2021, 3:36 AM

It was fixed in: rPTH223e59f992f9: build: Define _NPTH_NO_RWLOCK when we can't find pthread_rwlock_t. and rPTH09a12a679ec0: Fix how we expose rwlock API.

Perhaps, it's better to have new release (last release was three years ago).

Okay, any thing else missing in nPth?

I have a little concern for glibc 2.34 (which has dummy libpthread and all is actually in libc).

Debian, Gentoo, Archlinux are still using glibc 2.33 or older.

Looking Fedora which uses glibc 2.34, it looks OK.

Thanks! I was able to compile the current source code of npth (1.7) (with gcc 7.1. and ldd (GNU libc) 2.3.2 ). The error error: unknown type name ‘pthread_rwlock_t’ didn't occour.

Fixed in npth 1.7.

@thesamesam Thank you for the report.

Please test a patch below:

diff --git a/configure.ac b/configure.ac
index c1091b1..576a26e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -381,7 +381,10 @@ fi
 AC_SUBST(INSERT_NO_RWLOCK)
 
 case "${host}" in
-    *-*-linux*|*-*-gnu*)
+    *-*-linux-musl*)
+        INSERT_EXPOSE_RWLOCK_API="1"
+        ;;
+    *-*-linux-gnu*|*-*-gnu*)
         INSERT_EXPOSE_RWLOCK_API="defined(__USE_UNIX98) || defined(__USE_XOPEN2K)"
         ;;
     *)