glucose and xgl progress

José Fonseca jrfonseca at tungstengraphics.com
Wed Sep 19 03:20:49 PDT 2007


On Tue, 18 Sep 2007 18:47:09 +0100, José Fonseca wrote:
> At this moment, Xgl in glucose-2 branch runs normal 2D and XVideo apps
> OK. However GLX crashes. The problem seems to be duplicate symbols in
> dynamic shared libraries. Namely, Xgl seems to be picking dynamically
> symbols from glxcmds.c inside my system's /usr/lib/libGL.so (that comes
> from Mesa) and the glxcmds.c that lives in xserver/GL/glx .
> 
> I'm not sure if this problem was caused by my changes to get Xgl
> compile, or to recent changes to Mesa/Xorg source. Can anybody provide
> some hints?

I've discovered a bit deeper: one function, __glXFreeContext, exists both in / 
usr/lib/libGl.so and /opt/xorg/lib/xorg/modules/xgl/libglxext.so :

$ grep __glXFreeContext  /usr/lib/libGL.so
Binary file /usr/lib/libGL.so matches
$ grep __glXFreeContext  /opt/xorg/lib/xorg/modules/xgl/libglxext.so
Binary file /opt/xorg/lib/xorg/modules/xgl/libglxext.so matches

It is *not* an undefined symbol in libglxext.so:

$ ldd -r /opt/xorg/lib/xorg/modules/xgl/libglxext.so 
undefined symbol: PixmapWidthPaddingInfo        (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
        linux-gate.so.1 =>  (0xb7f86000)
        libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7c2d000)
        librt.so.1 => /lib/i686/cmov/librt.so.1 (0xb7c24000)
        libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7adb000)
        /lib/ld-linux.so.2 (0x80000000)
        libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7ac4000)
undefined symbol: screenInfo    (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: StandardMinorOpcode   (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: Xstrdup       (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: Xrealloc      (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: CreateScratchGC       (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: ErrorF        (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: Xalloc        (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: AttendClient  (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: LookupIDByType        (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: LogMessage    (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: WriteToClient (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: FakeClientID  (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: FreeResourceByType    (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: DamageDestroy (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: FindWindowWithOptional        (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: AllocColor    (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: FreeResource  (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: Xcalloc       (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: Xfree (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: ResetCurrentRequest   (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: dixLookupDrawable     (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: CreateNewResourceType (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: QueryColors   (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: LegalNewID    (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: FreeScratchGC (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: IgnoreClient  (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: AddExtensionAlias     (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: DamageUnregister      (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: ValidateGC    (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: dixChangeGC   (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: AddExtension  (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: AddResource   (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: FatalError    (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)
undefined symbol: FreeColors    (/opt/xorg/lib/xorg/modules/xgl/libglxext.so)

However, when loaded, references to __glXFreeContext *inside* 
libglxgext.so are linked to the external __glXFreeContext in libGL.so:

$ LD_DEBUG=all /opt/xorg/bin/Xgl :1 -ac  -accel glx:pbuffer -accel xv:fbo
...
     32507:	symbol=__glXFreeContext;  lookup in file=/opt/xorg/bin/Xgl [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/opt/xorg/lib/libXfont.so.1 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/opt/xorg/lib/libXau.so.6 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/opt/xorg/lib/libfontenc.so.1 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/opt/xorg/lib/libpixman-1.so.0 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/opt/xorg/lib/libXdmcp.so.6 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/opt/xorg/lib/libglitz-glx.so.1 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/opt/xorg/lib/libX11.so.6 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/lib/i686/cmov/libpthread.so.0 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/lib/i686/cmov/libdl.so.2 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/lib/i686/cmov/libm.so.6 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/lib/i686/cmov/librt.so.1 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/lib/i686/cmov/libc.so.6 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/opt/xorg/lib/libglitz.so.1 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/usr/lib/libfreetype.so.6 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/usr/lib/libz.so.1 [0]
     32507:	symbol=__glXFreeContext;  lookup in file=/usr/lib/libGL.so.1 [0]
     32507:	binding file /opt/xorg//lib/xorg/modules/xgl/libglxext.so [0] to /usr/lib/libGL.so.1 [0]: normal symbol `__glXFreeContext'
...

This causes Xgl to crash whenever a GLX client disconnects.

Other symbols are linked OK, but just by chance, e.g.:

     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/bin/Xgl [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libXfont.so.1 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libXau.so.6 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libfontenc.so.1 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libpixman-1.so.0 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libXdmcp.so.6 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libglitz-glx.so.1 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libX11.so.6 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/lib/i686/cmov/libpthread.so.0 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/lib/i686/cmov/libdl.so.2 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/lib/i686/cmov/libm.so.6 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/lib/i686/cmov/librt.so.1 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/lib/i686/cmov/libc.so.6 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libglitz.so.1 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/usr/lib/libfreetype.so.6 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/usr/lib/libz.so.1 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/usr/lib/libGL.so.1 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libxcb-xlib.so.0 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libxcb.so.1 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/lib/ld-linux.so.2 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libXext.so.6 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libXxf86vm.so.1 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libXdamage.so.1 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libXfixes.so.3 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg/lib/libdrm.so.2 [0]
     32507:	symbol=__glXDrawableInit;  lookup in file=/opt/xorg//lib/xorg/modules/xgl/libglxext.so [0]
     32507:	binding file /opt/xorg//lib/xorg/modules/xgl/libglxext.so [0] to /opt/xorg//lib/xorg/modules/xgl/libglxext.so [0]: normal symbol `__glXDrawableInit'

So the problem is that the dynamic linker is searching libglxext.so 
symbols outside libglxext.so first, which is a recipe for disaster.

libtool's -export-dynamic flag is not being used. Using libtool's -module 
flag doesn't change anything.

This problem is likely to happen only with DRI's libGL (as closed-source 
binary libGL's export different symbols). However DRI drivers were 
supported by Xgl in the past, so this problem should have happened before too.

José Fonseca




More information about the xorg mailing list