Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./configure fails if libpthread is absent #952

Open
RossBencina opened this issue Aug 2, 2024 · 1 comment
Open

./configure fails if libpthread is absent #952

RossBencina opened this issue Aug 2, 2024 · 1 comment
Labels
build-autoconf Autoconf build system linux Affects Linux P2 Priority: High
Milestone

Comments

@RossBencina
Copy link
Collaborator

(thanks to simphone project for reporting this by email)

some (newer) linux systems have pthread_create in libc; libpthread may or may not be present as a stub/wrapper library. if libpthread is not present, portaudio configure would fail for no good reason. A workaround is:

diff -urb portaudio/configure portaudio/configure
--- portaudio/configure
+++ portaudio/configure
@@ -16169,8 +16170,6 @@
 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
 if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
   have_pthread="yes"
-else
-  as_fn_error $? "libpthread not found!" "$LINENO" 5
 fi
 
 
diff -urb portaudio/configure.in portaudio/configure.in
--- portaudio/configure.in
+++ portaudio/configure.in
@@ -390,8 +391,7 @@
 
         CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix"
 
-        AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"],
-                AC_MSG_ERROR([libpthread not found!]))
+        AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"])
 
         if [[ "$have_alsa" = "yes" ] && [ "$with_alsa" != "no" ]] ; then
            DLL_LIBS="$DLL_LIBS -lasound"

of course, simply removing the error check is not the best solution here; one should probably check for pthread_create
also in libc, and then fail if not found there either. but we leave such improvements to the portaudio team. for us, simply not failing is good enough, as we've not seen unix systems that lack pthread support for a
very long time now.

@RossBencina
Copy link
Collaborator Author

So I guess the correct fix should be:

-        AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"],
-                AC_MSG_ERROR([libpthread not found!]))
+        AC_CHECK_LIB(pthread, pthread_create,[have_libpthread="yes"])
+        AC_CHECK_LIB(c, pthread_create,[have_libc_pthread="yes"])
+
+         if [[ "$have_libpthread" = "no" ] && [ "$have_libc_pthread" != "no" ]] ; then
+            AC_MSG_ERROR([pthread not found!]))
+         fi

maybe also omit -lpthread when `$have_libpthread$=="no"

@RossBencina RossBencina added build-autoconf Autoconf build system linux Affects Linux labels Aug 2, 2024
@RossBencina RossBencina added this to the V19.8 milestone Aug 2, 2024
@RossBencina RossBencina added the P2 Priority: High label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-autoconf Autoconf build system linux Affects Linux P2 Priority: High
Projects
None yet
Development

No branches or pull requests

1 participant