[Mesa-dev] Mesa (master): configs: Add -lstdc++ to default.

Joakim Sindholt bacn at zhasha.com
Fri Aug 20 00:45:58 PDT 2010

On Fri, 2010-08-20 at 09:09 +0200, Luca Barbieri wrote:
> > configs: Add -lstdc++ to default.
> Does this actually work if the application itself links to a different
> version of libstdc++ such as libstdc++.so.5?
> If not, it might be necessary to use -lstdc++_pic to link to the PIC
> static library version.
> LLVM probably has the same problem too (but in this case I doubt
> anyone ships a PIC static library of it).

        This fixes the following error when trying to run glxinfo or
        glxgears with swrast.
        undefined symbol: __cxa_pure_virtual

This looks more like C++ code linked with a C compiler. I did something
similar with my D3D9 tests. Basically the idea was to avoid linking with
libstdc++ and that specific function is what the compiler will call if
you call a pure virtual function. I implemented it myself like this from
looking at various people trying the same thing:

#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
&& defined(__ELF__)
#   define INTERNAL  __attribute__((visibility("internal")))
#   define INTERNAL

extern "C" INTERNAL void
__cxa_pure_virtual( void ) { while (1); }

Assuming you don't call pure virtual functions (as in call them without
overloading) this particular error handler will never be called anyway.

More information about the mesa-dev mailing list