Skip to content
  • Matt Turner's avatar
    build: Define _GNU_SOURCE for pthread_getname_np · 10369b9a
    Matt Turner authored
    With clang-16, implicit function definitions are treated as errors. As a
    result, the check for pthread_getname_np fails because
    pthread_getname_np is only provided under _GNU_SOURCE (see
    pthread_getname_np(3))
    
    > Checking if "pthread_getname_np" : links: NO
    
    The compilation failure is
    
    > error: implicit declaration of function 'pthread_getname_np' [-Werror,-Wimplicit-function-declaration]
    
    The inclusion of pthread.h lib/rb-debug.c must be moved above the system
    headers because they may include pthread.h themselves (and in practice
    unistd.h does). If that change is not done, lib/rb-debug.c will fail to
    compile for the same reason as the configure test.
    
    Note that to test this, one must disable prctl() detection.
    
    Bug: https://bugs.gentoo.org/898926
    10369b9a