Opened 7 weeks ago

Closed 3 weeks ago

#11121 closed defect (invalid)

configure: fails to detect pthread_setname_np

Reported by: Sebastian Ramacher Owned by:
Priority: normal Component: build system
Version: git-master Keywords:
Cc: Sebastian Ramacher Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Builds on Debian currently produce the following warning:

gcc -I. -Isrc/ -Wdate-time -D_FORTIFY_SOURCE=2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -DBUILDING_avfilter -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fno-strict-overflow -fstack-protector-all -fPIE   -std=c17 -fomit-frame-pointer -fPIC     -pthread   -I/usr/include/p11-kit-1  -I/usr/include/lilv-0 -I/usr/include/serd-0 -I/usr/include/sord-0 -I/usr/include/zix-0 -I/usr/include/sratom-0 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sysprof-6 -pthread -I/usr/include/fribidi -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/bs2b    -I/usr/include/libdrm   -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sysprof-6 -pthread  -DHWY_SHARED_DEFINE  -I/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include -I/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/vpl -DMFX_DEPRECATED_OFF  -I/usr/include/openjpeg-2.5 -I/usr/include/x86_64-linux-gnu -I/usr/include/opus -I/usr/include/opus  -D_REENTRANT  -I/usr/include/rav1e -I/usr/include/cjson -I/usr/include/librsvg-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -I/usr/include/webp -pthread -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1     -I/usr/include/srt -I/usr/include/p11-kit-1 -I/usr/include/svt-av1 -DEB_DLL        -I/usr/include/webp -I/usr/include/webp -DX264_API_IMPORTS   -isystem /usr/include/mit-krb5 -I/usr/include/pgm-5.3 -I/usr/include/libxml2 -I/usr/include/x86_64-linux-gnu  -I/usr/include/libxml2 -I/usr/include/AL  -I/usr/include/sphinxbase -I/usr/include/pocketsphinx -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu/sphinxbase        -I/usr/include/libdrm     -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-const-variable -Wno-bool-operation -Wno-char-subscripts -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -fdiagnostics-color=auto -Wno-maybe-uninitialized -I/usr/include/SDL2 -D_REENTRANT   -MMD -MF libavfilter/scale_eval.d -MT libavfilter/scale_eval.o -c -o libavfilter/scale_eval.o src/libavfilter/scale_eval.c
In file included from src/libavutil/common.h:48,
                 from src/libavutil/avutil.h:301,
                 from src/libavutil/opt.h:31,
                 from src/libavdevice/sdl2.c:31:
./config.h:335:9: warning: "HAVE_PTHREAD_SETNAME_NP" redefined
  335 | #define HAVE_PTHREAD_SETNAME_NP 0
      |         ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/SDL2/SDL_config.h:4,
                 from /usr/include/SDL2/SDL_stdinc.h:31,
                 from /usr/include/SDL2/SDL_main.h:25,
                 from /usr/include/SDL2/SDL.h:32,
                 from src/libavdevice/sdl2.c:26:
/usr/include/x86_64-linux-gnu/SDL2/_real_SDL_config.h:209:9: note: this is the location of the previous definition
  209 | #define HAVE_PTHREAD_SETNAME_NP 1
      |         ^~~~~~~~~~~~~~~~~~~~~~~

This indicates that configure does not detect the availability of pthread_setname_np. Indeed, even on master I get (on Debian unstable) with no flags passed to configure:

$ grep PTHREAD config.h
#define HAVE_PTHREAD_NP_H 0
#define HAVE_PTHREAD_CANCEL 1
#define HAVE_PTHREAD_SET_NAME_NP 0
#define HAVE_PTHREAD_SETNAME_NP 0
#define HAVE_PTHREADS 1

But the function is available:

$ nm -D /usr/lib/i386-linux-gnu/libc.so.6 | grep pthread_setname_np
00091690 T pthread_setname_np@GLIBC_2.12
00091690 T pthread_setname_np@@GLIBC_2.34

Change History (4)

comment:1 by elenril, 7 weeks ago

The problem is in SDL - its public headers define this macro and override our definition.

comment:2 by Sebastian Ramacher, 7 weeks ago

No. SDL was only the the gateway to discover the bug. Also in a build without SDL, the availability of the function is not detected.

comment:3 by elenril, 7 weeks ago

Ah, you're right. Still, why is not detecting that function a problem? It's only relevant for Apple and BSD, on Linux we use prctl() to set the thread name.
Seems it's gated behind GNU_SOURCE in glibc, and we probably don't want to go there.

comment:4 by elenril, 3 weeks ago

Resolution: invalid
Status: newclosed

Given lack of reply, I assume it's not actually a bug.

Note: See TracTickets for help on using tickets.