[Mesa-dev] [PATCH] gbm: dlopen libglapi so gbm_create_device works

Emil Velikov emil.l.velikov at gmail.com
Sat Nov 8 16:13:48 PST 2014


On 06/11/14 21:29, Frank Henigman wrote:
> From: Frank Henigman <fjhenigman at chromium.org>
> 
> Dri driver libs are not linked to pull in libglapi so gbm_create_device()
> fails when it tries to dlopen them (unless the application is linked
> with something that does pull in libglapi, like libGL).
> Until dri drivers can be fixed properly, dlopen libglapi before trying
> to dlopen them.
> https://bugs.freedesktop.org/show_bug.cgi?id=57702
> 
Hi Frank,

I think I can understand the frustration that this has caused you, so
unless there are any objections I will gladly pick it up for the 10.4
(and if there are no side effects for the stable 10.3 branch).

Just a couple of nits, which I'm planning to make prior to pushing this
(a week from now, just before the branchpoint)
 * the bugzilla report mentiones libglapi, but in a different light so
I'll rephase the commit msg a bit.
 * we might as well print out an error message and bail out when we
dlopen fails.

Thanks for bringing this up :)

-Emil

> Signed-off-by: Frank Henigman <fjhenigman at google.com>
> ---
>  src/gbm/backends/dri/gbm_dri.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
> index f637e32..6ea2294 100644
> --- a/src/gbm/backends/dri/gbm_dri.c
> +++ b/src/gbm/backends/dri/gbm_dri.c
> @@ -311,6 +311,11 @@ dri_open_driver(struct gbm_dri_device *dri)
>     if (search_paths == NULL)
>        search_paths = DEFAULT_DRIVER_DIR;
>  
> +   /* Temporarily work around dri driver libs that need symbols in libglapi
> +    * but don't automatically link it in.
> +    */
> +   dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL);
> +
>     dri->driver = NULL;
>     end = search_paths + strlen(search_paths);
>     for (p = search_paths; p < end && dri->driver == NULL; p = next + 1) {
> 



More information about the mesa-dev mailing list