Bug 55577 - xf86-video-intel-2.20.9 does not build with xorg server 1.13
Summary: xf86-video-intel-2.20.9 does not build with xorg server 1.13
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: 7.7 (2012.06)
Hardware: All Linux (All)
: high critical
Assignee: Chris Wilson
QA Contact: Xorg Project Team
Depends on:
Reported: 2012-10-03 13:34 UTC by Giovanni Mariani
Modified: 2012-10-03 13:44 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Log of a failed build (37.33 KB, text/plain)
2012-10-03 13:34 UTC, Giovanni Mariani
no flags Details

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)
 struct drm_prime_handle 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;
 return -1;

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.