Bug 55577

Summary: xf86-video-intel-2.20.9 does not build with xorg server 1.13
Product: xorg Reporter: Giovanni Mariani <mc2374>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: critical    
Priority: high    
Version: 7.7 (2012.06)   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Log of a failed build none

Description Giovanni Mariani 2012-10-03 13:34:16 UTC
Created attachment 68040 [details]
Log of a failed build

Trying to build it against:
libdrm 2.4.39
mesa snapshot from 9.0 branch at 09/22/2012
xorg 1.13.0.

The build fails with this error (see the whole build log attached below):
kgem.c: In function 'kgem_bo_export_to_prime':
kgem.c:2849: error: 'O_CLOEXEC' undeclared (first use in this function)
kgem.c:2849: error: (Each undeclared identifier is reported only once
kgem.c:2849: error: for each function it appears in.)

This is the code snippet from kgem.c, indicated by the error message
**************************************
int kgem_bo_export_to_prime(struct kgem *kgem, struct kgem_bo *bo)
{
#ifdef DRM_IOCTL_PRIME_HANDLE_TO_PRIME
 struct drm_prime_handle args;

 VG_CLEAR(args);
 args.handle = bo->handle;
 args.flags = DRM_CLOEXEC;  // <== this is line 2849

 if (drmIoctl(kgem->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args))
 return -1;

 bo->reusable = false;
 return args.fd;
#else
 return -1;
#endif
******************************************

It was added with the df68723baae71498de95924c72d4f23fa7fc7fdf commit at the starting of the month of september (09/04).
Comment 1 Chris Wilson 2012-10-03 13:39:55 UTC
DRM_CLOEXEC was added in libdrm 2.4.34 and would be implied by the existence of DRM_IOCTL_PRIME_HANDLE_TO_PRIME.

Something would appear to be wrong with your build system.
Comment 2 Chris Wilson 2012-10-03 13:40:33 UTC
Meh, misread. O_CLOEXEC means your libc is too old.
Comment 3 Chris Wilson 2012-10-03 13:44:00 UTC
This will fix the build

commit 0d42872d1e0bab1808c0a544c7ece049da103825
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Oct 3 14:42:19 2012 +0100

    sna: Protect against undefined O_CLOEXEC
    
    Reported-by: Giovanni Mariani <mc2374@mclink.it>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55577
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

but you want to update your kernel/libc headers.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.