Bug 78225

Summary: Compile error due to undefined reference to `gbm_dri_backend', fix attached
Product: Mesa Reporter: Bernd Kuhls <berndkuhls>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: 10.1   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Fix gbm compile without dri

Description Bernd Kuhls 2014-05-03 16:24:30 UTC
Created attachment 98379 [details]
Fix gbm compile without dri

Tested with mesa3d 10.2-rc1, configure options used:
--disable-glx --disable-xa --disable-static --enable-shared-glapi --with-gallium-drivers=swrast --disable-dri --without-dri-drivers --enable-opengl --enable-gbm --enable-egl --with-egl-platforms=drm --enable-gles1 --enable-gles2

configure summary:

        OpenGL:          yes (ES1: yes ES2: yes)
        OpenVG:          no

        OSMesa:          no
        GLX:             no

        EGL:             yes
        EGL platforms:   drm
        EGL drivers:

        llvm:            no

        Gallium:         yes
        Target dirs:
        Winsys dirs:     sw
        Driver dirs:     galahad identity noop rbug softpipe trace
        Trackers dirs:

        Shared libs:     yes
        Static libs:     no
        Shared-glapi:    yes

mesa3d compiles without errors, but other apps needing mesa3d fail to compile, like xbmc 12.3:

checking for main in -lEGL... no
configure: error: Could not find a required library. Please see the README for your platform.

snippet from xbmc config.log:

configure:19532: checking for main in -lEGL
configure:19551: /home/br2/output/host/usr/bin/i686-pc-linux-gnu-gcc -o conftest -O2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -Os  -I/home/fli4l/br2/output/host/usr/i586-buildroot-linux-gnu/sysroot/usr/include  -DMESA_EGL_NO_X11_HEADERS   -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG=1 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  conftest.c -lEGL   -lpython2.7 -lpthread -ldl -lutil -lm >&5
/home/br2/output/host/usr/i586-buildroot-linux-gnu/sysroot/usr/lib32/libgbm.so.1: undefined reference to `gbm_dri_backend'
collect2: error: ld returned 1 exit status

The attached patch fixes the problem.
Comment 1 Emil Velikov 2014-05-03 18:28:34 UTC
Have you tried using EGL with the mentioned config/patch ?

AFAICS both gbm backends require DRI, thus in your case you're building only an empty libgbm library which does not provide much functionality on it's own.

If you want a gallium based swrast + opengl, egl etc. I would drop the "disable-dri" part.

Meanwhile I'll prep a patch that errors out on --enable-gbm --disable-dri.
Comment 2 Emil Velikov 2014-05-10 01:11:10 UTC
As mentioned previously, building gbm without dri i.e. without any backends serves little benefit. With the following commit we'll avoid that error-ing at configure time.

commit e477d12c3396ded1607b6f57c15e100ca08f44f5
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Mon May 5 22:09:22 2014 +0100

    configure: error out if building GBM without dri
    
    Both backends require --enable-dri, and building an empty libgbm
    makes little to no sense. Error out at configure to prevent the
    user from shooting themselves in the foot.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct.