Bug #80402 [Com]: configure filtering out -lpthread

From: Date: Mon, 23 Nov 2020 01:19:52 +0000
Subject: Bug #80402 [Com]: configure filtering out -lpthread
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230527@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80402&edit=1

 ID:                 80402
 Comment by:         bjornar dot ness at gmail dot com
 Reported by:        bjornar dot ness at gmail dot com
 Summary:            configure filtering out -lpthread
 Status:             Open
 Type:               Bug
 Package:            *Configuration Issues
 Operating System:   linux
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

The only, but ugly, way I have managed to find around this atm is:

LIBS="-lpthread" LDFLAGS="-Wl,--start-group" /path/to/configure


Previous Comments:
------------------------------------------------------------------------
[2020-11-23 00:20:51] bjornar dot ness at gmail dot com

Description:
------------
php's configure script has multiple places where it filters out -lpthread from $LIBS
before ac_fn_c_try_link

This is likely ok for shared, but causes problems with static libs.
One example of this is when building openssl static.

# pkg-config openssl --libs

-L/usr/src/php-build/install/OpenSSL_1_1_1h/lib -lssl -lz -lcrypto -lpthread -ldl

Problem is, when configure tries to check this rule, it filters out some libs from
what it was told by pkg-config:

(looping through $XXXX_LIBS)
case $ac_ii in
c|c_r|pthread*) ;;
*)
 LIBS="$LIBS -l$ac_ii"
;;
esac
(end loop)

ac_fn_c_try_link

ac_fn_c_try_link basically does:

$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5

and in my case then, results in the following libs:

-lssl -lz -lcrypto -ldl

note -lpthread missing, and the test failing.

I have not managed to find a way around this without modifying the configure file, adding -lpthread
where it needs to be.

The rest of the actual build is just fine after manually adding -lpthread to just the relevant
tests.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80402&edit=1


Thread (7 messages)

« previous php.bugs (#230527) next »