libcamera: egl: Don't redefine EGL_NO_X11
diff mbox series

Message ID 20261013223403.1242372-1-joel.winarske@linux.com
State New
Headers show
Series
  • libcamera: egl: Don't redefine EGL_NO_X11
Related show

Commit Message

Joel Winarske Oct. 13, 2026, 10:34 p.m. UTC
Mesa <= 22.2 (and forks based on it, e.g. the PowerVR mesa-pvr used on
StarFive JH7110) export -DEGL_NO_X11 via egl.pc Cflags. The
unconditional define in egl.h then redefines it with a different value,
which is an error with -Werror:

  include/libcamera/internal/egl.h:23:9: error: 'EGL_NO_X11' redefined [-Werror]

Only define it when it isn't already set.

Signed-off-by: Joel Winarske <joel.winarske@linux.com>
---
 include/libcamera/internal/egl.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kieran Bingham Oct. 14, 2026, 6:42 a.m. UTC | #1
Quoting Joel Winarske (2026-10-13 23:34:03)
> Mesa <= 22.2 (and forks based on it, e.g. the PowerVR mesa-pvr used on
> StarFive JH7110) export -DEGL_NO_X11 via egl.pc Cflags. The
> unconditional define in egl.h then redefines it with a different value,
> which is an error with -Werror:
> 
>   include/libcamera/internal/egl.h:23:9: error: 'EGL_NO_X11' redefined [-Werror]
> 
> Only define it when it isn't already set.
> 
> Signed-off-by: Joel Winarske <joel.winarske@linux.com>

Does this mean we don't need the define at all ?
I guess we want it for something or we wouldn't have added it - but
maybe we should be getting a different flag from pkg-config ?

Anyway if we can't rely on it, then this looks like a clear solution so:

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  include/libcamera/internal/egl.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
> index 7d062b32d..9d2c9b5bc 100644
> --- a/include/libcamera/internal/egl.h
> +++ b/include/libcamera/internal/egl.h
> @@ -21,7 +21,9 @@
>   * Workaround for build issues on Mesa <= 22.2, see
>   * https://github.com/KhronosGroup/EGL-Registry/pull/130
>   */
> +#ifndef EGL_NO_X11
>  #define EGL_NO_X11
> +#endif
>  
>  #define EGL_EGLEXT_PROTOTYPES
>  #include <EGL/egl.h>
> -- 
> 2.56.0
>

Patch
diff mbox series

diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
index 7d062b32d..9d2c9b5bc 100644
--- a/include/libcamera/internal/egl.h
+++ b/include/libcamera/internal/egl.h
@@ -21,7 +21,9 @@ 
  * Workaround for build issues on Mesa <= 22.2, see
  * https://github.com/KhronosGroup/EGL-Registry/pull/130
  */
+#ifndef EGL_NO_X11
 #define EGL_NO_X11
+#endif
 
 #define EGL_EGLEXT_PROTOTYPES
 #include <EGL/egl.h>