Hi!
Le Wed, 10 Aug 2016 21:47:36 +0200,
Laurent Bercot <[email protected]> a écrit :
> On 10/08/2016 21:29, Laurent Bercot wrote:
> > putting the spawn.h functions in librt is valid, so uclibc-ng is
> > conforming and my autodetection is incorrect. I need to fix the
> > configure script.
>
> Eric: please test building the latest skalibs git head against
> uclibc-ng and tell me if it works. In particular, I'd like to know
> whether the posix_spawn autodetection works both when your compiler
> links dynamically by default (CC=gcc) and when you force it to link
> statically (CC="gcc -static").
Unfortunately, it does not work. The modification assumes that the
check for clock_gettime() will result in $rt_lib being set to -lrt, but
it is not the case for uclibc-ng, where this function is available in
the C runtime:
```
$ nm i686-buildroot-linux-uclibc/sysroot/lib/librt-1.0.14.so \
| grep clock_gettime
00002308 T clock_gettime
00002308 t __GI_clock_gettime
$ nm i686-buildroot-linux-uclibc/sysroot/lib/libuClibc-1.0.14.so \
| grep clock_gettime
0000d5dd T clock_gettime
```
I modified ./configure to perform a more complicated test to handle
this case (see attached patch) but the build of the skaware programs
still fails because the -lrt sysdep is not added by default. Shouldn't
the deps-exe and deps-lib files of these programs be updated to add
${RT_LIB}?
BTW, I noticed that `s6-uevent-spawner` calls posix_spawnp() directly
instead of using child_spawn0().
So, for buildroot-s6, I ended up forcing -lrt in the runtime test
for posix_spawnp() in the ./configure script and passing LDLIBS=-lrt
to `make` when uclibc is selected [1].
[1]
https://github.com/elebihan/buildroot-s6/commit/98c9547fb3720859514b99d165aa80649a8a1ece
Best regards,
--
ELB
>From 9ad3c1032c3bac5f2e391c418324f26ee8abbe2d Mon Sep 17 00:00:00 2001
From: Eric Le Bihan <[email protected]>
Date: Thu, 11 Aug 2016 19:57:09 +0200
Subject: [PATCH] configure: rework posix_spawn() detection
As uclibc-ng provides posix_spawn() in librt, rework the detection of
this function in the ./configure script to handle this situation.
---
configure | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index e4a1866..5320e41 100755
--- a/configure
+++ b/configure
@@ -450,6 +450,37 @@ EOF
echo ' ... no'
fi
+ echo "Checking whether system has posix_spawn()..."
+ hasposixspawn=true
+ if $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -c -o tryposixspawn.o src/sysdeps/tryposixspawn.c 2>/dev/null ; then
+ if $CC_AUTO $CFLAGS_AUTO $LDFLAGS_AUTO -o /dev/null tryposixspawn.o 2>/dev/null ; then
+ rt_lib=
+ echo " ... yes"
+ elif $CC_AUTO $CFLAGS_AUTO $LDFLAGS_AUTO -o /dev/null tryposixspawn.o -lrt 2>/dev/null ; then
+ rt_lib=-lrt
+ echo " ... yes, with -lrt"
+ else
+ hasposixspawn=false
+ fi
+ rm -f tryposixspawn.o
+ else
+ hasposixspawn=false
+ fi
+ if $hasposixspawn ; then
+ rm -f tryposixspawn
+ if test "$rt_lib" = "-lrt" ; then
+ if ! grep -q "\-lrt" $sysdeps/rt.lib; then
+ echo "-lrt" > $sysdeps/rt.lib
+ fi
+ fi
+ echo 'posixspawn: yes' >> $sysdeps/sysdeps
+ echo "#define ${package_macro_name}_HASPOSIXSPAWN" >> $sysdeps/sysdeps.h
+ else
+ echo 'posixspawn: no' >> $sysdeps/sysdeps
+ echo "#undef ${package_macro_name}_HASPOSIXSPAWN" >> $sysdeps/sysdeps.h
+ echo ' ... no'
+ fi
+
echo "Checking system endianness..."
$CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -o tryendianness src/sysdeps/tryendianness.c
endianness=$(./tryendianness) || fail "$0: unable to determine endianness"
@@ -480,7 +511,6 @@ EOF
choose cl openat OPENAT 'openat()'
choose cl linkat LINKAT 'linkat()'
choose clr pipe2 PIPE2 'pipe2()'
- choose cl posixspawn POSIXSPAWN 'posix_spawn()' $rt_lib
choose clr ppoll PPOLL 'ppoll()'
choose cl revoke REVOKE 'revoke()'
choose cl sendfile SENDFILE 'sendfile()'
--
2.4.11