Bug 26852 - Build libkms against in-tree xf86drm.h
Build libkms against in-tree xf86drm.h
Status: RESOLVED FIXED
Product: DRI
Classification: Unclassified
Component: libdrm
XOrg git
Other All
: medium normal
Assigned To: Default DRI bug account
:
: 30782 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-02 18:07 UTC by Christopher James Halse Rogers
Modified: 2011-03-07 10:30 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Add include dir to libkms Makefile (326 bytes, patch)
2010-03-02 18:07 UTC, Christopher James Halse Rogers
no flags Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher James Halse Rogers 2010-03-02 18:07:15 UTC
Created attachment 33703 [details] [review]
Add include dir to libkms Makefile

libkms includes files which include xf86drm.h, but doesn't include the in-tree xf86drm.h in the library include path.  This means it will build against the installed header in /usr/include which is probably not the expected behaviour, or if built in a clean chroot will simply fail to build.

Trivial patch attached to fix.
Comment 1 Sérgio M. Basto 2010-03-02 20:13:53 UTC
The question is, if libkms depends on kernel ? and yes I thinks so .
Therefore, if libkms , depends on kernel should use xf86drm.h of /usr/include.
In this point of view, libkms should know deal with different kernels or even warn if kernel version is not good.

"built in a clean chroot will simply fail to build" , I think that solves install kernel-sources first .

Note: this is my opinion, may not be write. 
Comment 2 Michel Dänzer 2010-03-03 03:15:54 UTC
(In reply to comment #1)
> The question is, if libkms depends on kernel ? and yes I thinks so .
> Therefore, if libkms , depends on kernel should use xf86drm.h of /usr/include.
> In this point of view, libkms should know deal with different kernels or even
> warn if kernel version is not good.

It needs to deal with that at runtime, not build time.
Comment 3 Christopher James Halse Rogers 2010-05-25 23:35:04 UTC
So, until there's an actual kernel incompatibility introduced for which runtime detection in libkms is necessary, is there any reason not to apply this patch?  

Building against the headers shipped in the source alongside it makes much more sense to me.
Comment 4 Julien Cristau 2010-06-10 14:09:20 UTC
the headers part was fixed in ae57dcf6e063860200b7949d5e2365e80ac4aea7, but libdrm is still missing from libkms_la_LIBADD.
Comment 5 Sérgio M. Basto 2010-06-15 21:12:52 UTC
What I'm try to say is, I think the ./configure of libdrm, should check what kernel version we have on system and require a version of kernel bigger than a number which libdrm, we are compiling, works. 

Is not logic, build libdrm-2.4.21 with a kernel <= 2.6.26 , I think. So libdrm should avoid those situations.
Comment 6 Julien Cristau 2010-10-11 13:32:58 UTC
*** Bug 30782 has been marked as a duplicate of this bug. ***
Comment 7 Cyril Brulebois 2011-03-05 10:10:11 UTC
Ping? As described in the initial report, there's no reason to prefer system headers over those in the same source… I don't understand Sérgio's objection (I fail to see what's illogical).
Comment 8 Sérgio M. Basto 2011-03-05 17:28:01 UTC
(In reply to comment #7)
> Ping? As described in the initial report, there's no reason to prefer system
> headers over those in the same source… I don't understand Sérgio's objection (I
> fail to see what's illogical).

The illogical is, without that depending on kernel, you may try compile very new libdrm with a older kernel. 
libdrm-2.4.21 needs kms on kernel but kernel <= 2.6.26 don't have it.   

my 2 cents
Comment 9 Matt Turner 2011-03-05 18:07:50 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > Ping? As described in the initial report, there's no reason to prefer system
> > headers over those in the same source… I don't understand Sérgio's objection (I
> > fail to see what's illogical).
> 
> The illogical is, without that depending on kernel, you may try compile very
> new libdrm with a older kernel. 
> libdrm-2.4.21 needs kms on kernel but kernel <= 2.6.26 don't have it.   
> 
> my 2 cents

I think you're failing to understand the issue.

xf86drm.h is provided by libdrm. libkms (which is part of libdrm) uses xf86drm.h, but the Makefile searches in /usr/include instead of the $(top_src) directory, where libdrm's xf86drm.h is.

This is like if you have a library that consists of lib.c and lib.h, where lib.c includes lib.h. The Makefile would be incorrect in using lib.h found in /usr/include over the lib.h in the same folder as lib.c.
Comment 10 Christopher James Halse Rogers 2011-03-06 20:57:41 UTC
This was fixed in ae57dcf6 anyway :)
Comment 11 Julien Cristau 2011-03-07 10:30:26 UTC
> --- Comment #10 from Christopher James Halse Rogers <chalserogers@gmail.com> 2011-03-06 20:57:41 PST ---
> This was fixed in ae57dcf6 anyway :)
> 
only partly, see comment#4.