[Mesa-dev] Undefined reference in libGLES when shared glapi is disabled

Eric Le Bihan eric.le.bihan.dev at free.fr
Mon Apr 28 14:56:00 PDT 2014


Hi!

I'm currently cross-compiling Mesa3d for embedded systems using the
following configure options:

 --enable-shared  --disable-glx --disable-xa --disable-static
 --with-gallium-drivers=svga --disable-dri --disable-shared-glapi
 --without-dri-drivers --enable-opengl --disable-gbm --disable-egl
 --enable-gles1 --enable-gles2

So: no DRI, GALLIUM3D drivers, GLES only and no shared glapi. The build is
successful, but when trying to link another program to libGLESv2.so, I get an
undefined reference to _glapi_get_dispatch().

Looking at src/mapi/es2api/Makefile.am, I can see that, when
--disable-shared-glapi is passed, the libglapi is not added as dependency:

  if HAVE_SHARED_GLAPI
    libGLESv2_la_LIBADD += ../shared-glapi/libglapi.la
  endif

But unfortunately it does not seem to be handled in src/mapi/entry.c, which is
used to build libGLESv{1,2}.so and libglapi.so. In this file, we have:

  /* in bridge mode, mapi is a user of glapi */
  #ifdef MAPI_MODE_BRIDGE
  #define ENTRY_CURRENT_TABLE_GET "_glapi_get_dispatch"
  #else
  #define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_internal)
  #endif

When comparing src/mapi/glapi/Makefile.am and src/map/es2api/Makefile.am, I
can see that, when passing --disable-shared-glapi, MAPI_MODE_BRIDGE is handled
differently. For libGLESv2.so, entry.c will be compiled with
-DMAPI_MODE_BRIDGE, hence the reference to _glapi_get_dispatch().

I tried to pass -DMAPI_MODE_BRIDGE only if HAVE_SHARED_GLAPI is true for
libGLESv2, but ended with an error about MAPI_ABI_HEADER not being defined.

So, why is MAPI_MODE_BRIDGE handled differently? Is it forbidden to build
libGLES with shared glapi disabled?

Best regards,
ELB


More information about the mesa-dev mailing list