https://bugs.kde.org/show_bug.cgi?id=428909

--- Comment #17 from Paul Floyd <pjfl...@wanadoo.fr> ---

> Please change this into configure tests that verify whether pthreads
> functions exist in libpthread, libc or in both.

Hi Bart

That's a good idea, but the devil is in the details. I have two fairly big
questions.

1) which functions to test and
2) how to test for them

For point 1, for the platforms that I know of at the moment

Fedora 33
There are 34 pthread functions in libc and 72 in libpthread (28 only in libc,
66 only in libpthread and 6 in both).

(To count these I used

nm /lib64/libc.so.6 | grep " T " | grep " pthread" | sed 's/@.*// | awk '{print
$3}' | sort -u > c

and 

nm /lib64/libpthread.so.0  | grep " T " | grep " pthread" | sed 's/@.*// | awk
'{print $3}' | sort -u > p

to generate two text file lists c and p for libc and libpthread respectively,
then I used combinations of

comm c p -2 -3 | wc
comm c p -1 -3 | wc
comm c p -1 -2 | wc

to count libc, libpthread and both.

This is a bit simplistic as I'm not counting W symbols).

For comparison, openSuSE Leap 15.2 which uses glibc 2.26 has 7 only in libc 70
only in libpthread and 24 in both

Linux MUSL, everything is in /lib/ld-musl-x86_64.so.1. libc is a symlink to
this and there is no libpthread.

macOS I don't quite understand what is where, on my old macbook there is some
stuff in /usr/lib/libSystem.B.dylib and /usr/lib/libpthread.dylib is just a
symlink to this.

Solaris, libc contains everything and libpthread exists but just contains
absolute symbols.

FreeBSD, pthread functions are in libpthread but sem functions are in libc.

Next, question b) how to test this? I'm no expert in autoconf. It seems to me
that the AC_CHECK_LIB and AC_SEARCH_LIBS are not suitable since they don't
exclude libc, so this would require full AC_LINK_IFELSE style tests using
-nostlib and then either -lc or -lpthread, for each required platform
variation.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to