skalibs: how to properly detect posix_spawnp() when using uclibc-ng?

From: Eric Le Bihan <eric.le.bihan.dev_at_free.fr>
Date: Wed, 10 Aug 2016 18:02:43 +0200 (CEST)

Hi!

The ./configure script of skalibs tries to detect if posix_spawnp() is
available on the system by generating a runtime test and executing it.

For whichever reason, uclibc-ng provides this function in librt.a, not
in libc.a. So the runtime test fails when trying to link the test program.

Adding -lrt to the command line to build the test program should fix this,
but how to properly do it?

a) Using `LDFLAGS="-lrt" ./configure ...` is not correct. Should a $LIBS
variable be added and used in the `choose()` function of the script?
b) Should linking with librt be forced in the test, even if it is
unnecessary for other C runtimes? Example:

    choose cl posixspawn POSIXSPAWN 'posix_spawn()' -lrt

Besides, how should the sysdeps be updated to add the dependency to librt,
in order to avoid passing EXTRA_LIBS="-lrt" to `make` when building s6 and
friends?

Note that the current implementation of posix_spawnp() in uclibc is buggy.
It causes child_spawn0() to loop infinitely as described here [1]. A fix
has been sent upstream [2].

[1] https://www.mail-archive.com/supervision%40list.skarnet.org/msg01058.html
[2] http://mailman.uclibc-ng.org/pipermail/devel/2016-August/001126.html

Best regards,

--
ELB
Received on Wed Aug 10 2016 - 16:02:43 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC