Bug 64959 - Cannot build against EGL without X11
Cannot build against EGL without X11
Status: RESOLVED FIXED
Product: Mesa
Classification: Unclassified
Component: EGL
unspecified
Other All
: medium normal
Assigned To: Ross Burton
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-24 16:16 UTC by Ross Burton
Modified: 2013-07-01 18:24 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Don't include X11 headers if no X11 platform (1.14 KB, patch)
2013-06-27 10:53 UTC, Ross Burton
Details | Splinter Review
Use pointers instead of ints (1.10 KB, patch)
2013-06-27 10:53 UTC, Ross Burton
Details | Splinter Review
Don't include X11 headers if no X11 platform (1.38 KB, patch)
2013-06-27 11:35 UTC, Ross Burton
Details | Splinter Review
Use right size types (1.07 KB, patch)
2013-06-27 11:36 UTC, Ross Burton
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2013-05-24 16:16:00 UTC
I'm building wayland 1.1 and weston 1.1 in an environment without any X headers against Mesa 9.0.2:

| In file included from /data/poky-master/tmp/sysroots/atom-pc/usr/include/EGL/egl.h:36:0,
|                  from /data/poky-master/tmp/work/core2-poky-linux/weston/1.1.0-r0/weston-1.1.0/src/gl-renderer.h:30,
|                  from /data/poky-master/tmp/work/core2-poky-linux/weston/1.1.0-r0/weston-1.1.0/src/gl-renderer.c:35:
| /data/poky-master/tmp/sysroots/atom-pc/usr/include/EGL/eglplatform.h:118:22: fatal error: X11/Xlib.h: No such file or directory

Currently I'm working around this by adding -DMESA_EGL_NO_X11_HEADERS to CFLAGS but that's clearly not the right thing to do.
Comment 1 Andrew Knight 2013-05-29 12:37:02 UTC
If you build gallium targets, you additionally need to comment out the xlib_sw_winsys include in src/gallium/auxilliary/pipe-loader/pipe_loader_sw.c as it is not guarded either.
Comment 2 Chad Versace 2013-06-05 16:51:44 UTC
Does adding -DWL_EGL_PLATFORM to CFLAGS fix the problem? That seems to be the right define to use when building in a pure Wayland system.

Don't use -DMESA_EGL_NO_X11_HEADERS, because that may break ABI on 32-bit systems. The definitions of the EGLNative types in that block are 32-bit instead of 64-bit.
Comment 3 Quentin "Sardem FF7" Glidic 2013-06-25 07:14:18 UTC
(In reply to comment #2)
> Does adding -DWL_EGL_PLATFORM to CFLAGS fix the problem? That seems to be
> the right define to use when building in a pure Wayland system.

On a pure Wayland system, that works fine.


> Don't use -DMESA_EGL_NO_X11_HEADERS, because that may break ABI on 32-bit
> systems. The definitions of the EGLNative types in that block are 32-bit
> instead of 64-bit.

What is the correct solution when you have both Wayland and X11 EGL then? Should we define -DWL_EGL_PLATFORM as soon as wayland EGL support is enabled? Depends on the ordering of --with-egl-platforms?

As soon as there is an identified solution, I will provide a patch to add the needed flags to the egl.pc file.
Comment 4 Ross Burton 2013-06-26 14:22:36 UTC
For fun, current mesa master doesn't even compile without X11 headers:

| In file included from /.../mesa/2_9.2.0~gitAUTOINC+9aebad618c-r9.0/git/include/EGL/egl.h:36:0,
|                  from /.../mesa/2_9.2.0~gitAUTOINC+9aebad618c-r9.0/git/src/egl/main/egltypedefs.h:36,
|                  from /.../mesa/2_9.2.0~gitAUTOINC+9aebad618c-r9.0/git/src/egl/main/eglconfig.h:37,
|                  from /.../mesa/2_9.2.0~gitAUTOINC+9aebad618c-r9.0/git/src/egl/main/eglcontext.c:34:
| /.../mesa/2_9.2.0~gitAUTOINC+9aebad618c-r9.0/git/include/EGL/eglplatform.h:118:22: fatal error: X11/Xlib.h: No such file or directory
Comment 5 Ross Burton 2013-06-27 10:53:12 UTC
Created attachment 81544 [details] [review]
Don't include X11 headers if no X11 platform
Comment 6 Ross Burton 2013-06-27 10:53:28 UTC
Created attachment 81545 [details] [review]
Use pointers instead of ints
Comment 7 Quentin "Sardem FF7" Glidic 2013-06-27 10:57:47 UTC
(In reply to comment #5)
> Created attachment 81544 [details] [review] [review]
> Don't include X11 headers if no X11 platform

We should definitely add such a flag in egl.pc file too. Otherwise, programs built against EGL will fail to build too.
Comment 8 Ross Burton 2013-06-27 11:35:45 UTC
Created attachment 81547 [details] [review]
Don't include X11 headers if no X11 platform
Comment 9 Ross Burton 2013-06-27 11:36:07 UTC
Created attachment 81548 [details] [review]
Use right size types
Comment 10 Chad Versace 2013-06-27 20:51:53 UTC
[Assigning to Ross].

Ross, both these patches look good to me and are
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>

To ensure that the patches get backported to the stable branches 9.0 and 9.1 (because that's where the bug is really biting you), add the following tag above the signed-off line:
  Note: This patch is a candidate for the 9.0 and 9.1 branches.

Please mail them to mesa-dev so they can get reviewed and committed.