Skip to content
  • Lyude Paul's avatar
    meson: Don't redefine gettid if the C library provides it · ef7c18b0
    Lyude Paul authored
    
    
    glibc 2.30+ will actually include a definition for gettid() that makes
    it so that users don't have to manually define a wrapper for it
    themselves with syscall(). We don't currently check for this, and as a
    result will end up redefining gettid() on the latest versions of glibc,
    causing the build to fail:
    
    FAILED: lib/76b5a35@@igt-igt_kmod_c@sta/igt_kmod.c.o
    In file included from /usr/include/unistd.h:1170,
                     from ../../mnt/vol/lib/igt_core.h:43,
                     from ../../mnt/vol/lib/igt_kmod.c:28:
    /usr/include/bits/unistd_ext.h:34:28: error: macro "gettid" passed 1 arguments, but takes just 0
       34 | extern __pid_t gettid (void) __THROW;
          |                            ^
    In file included from ../../mnt/vol/lib/igt_kmod.c:27:
    ../../mnt/vol/lib/igt_aux.h:40: note: macro "gettid" defined here
       40 | #define gettid() syscall(__NR_gettid)
          |
    [36/771] Compiling C object 'lib/76b5a35@@igt-igt_kms_c@sta/igt_kms.c.o'.
    ninja: build stopped: subcommand failed.
    
    So, fix this by by adding some meson checks to define HAVE_GETTID whenever the
    host defines its own gettid(), and avoid redefining gettid() when HAVE_GETTID is
    defined.
    
    This fixes build igt-gpu-tools for me on Fedora Rawhide
    
    Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: default avatarPetri Latvala <petri.latvala@intel.com>
    Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
    ef7c18b0