[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RTTI problem: building OOo with gcc3.2



Debian is gearing up to moving to gcc3.2 as its compiler on all
architectures, and Jan & I have attempted to build OOo using gcc 3.2.  I
have submitted issue #6927 to add support in lbnames.h.

The next problem is a little more complicated.  It appears that a gcc bugfix
causes the build to break, due to the way in which runtime type information
is generated.

If RTTI is enabled, the compiler should emit type information for a given
class only if the virtual table can be emitted, i.e. all the declared
virtual functions have also been defined.  Given the following test file:

test.cxx -----------------
class test1 {
 public:
    virtual ~test1();
};

class test2 {
 public:
    virtual ~test2() {};
};

void x() {
  test1 t1;
  test2 t2;
}
-----------------------------

Class test1 does not have a definition for its destructor, so no type
information should be emitted.  Class test2 does have a definition for its
virtual desstructor, so type information is emitted:

$ g++ -c test.cxx ; nm -C test.o | grep typeinfo
00000000 V typeinfo for test2
00000000 V typeinfo name for test2

However, a compiler bug in g++ < 3.2 was causing RTTI information to be
emitted for such a class.  I discussed this on the Debian gcc list, and they
pointed out the lack of a definition for the class:
  http://lists.debian.org/debian-gcc/2002/debian-gcc-200208/msg00029.html

The class ucb::ContentProviderImplHelper was declared but not defined during
the compile of xmlhelp/source/cxxhelp/provider/provider.cxx.  This happened
to hide the fact that libucphelp1.so is built with RTTI yet
libucbhelper1gcc3.so (which defines ucb::ContentProviderImplHelper) is built
without RTTI.

gcc 3.2 fixes the compiler bug, and now there is no typeinfo generated for
ContentProviderImplHelper, and the build fails:

  Checking DLL ../unxlngi4.pro/lib/libucpchelp1.so ...: ERROR:
  ../unxlngi4.pro/lib/libucpchelp1.so: undefined symbol:
  _ZTIN3ucb25ContentProviderImplHelperE

So, at least the library that defines ucb::ContentProviderImplHelper
(libucbhelper1gcc3.so) needs to be compiled with RTTI, or libucpchelp1.so
needs to be compiled without RTTI.  For now, I have removed -fno-rtti from
the CXXFLAGS variable in solenv/inc/unxlngi4.mk, which enables RTTI for the
complete build.   Now the build is able to continue past xmlhelp, but I
don't know if that is the best way to solve the problem.  Is there a reason
not to enable RTTI for the complete build?

Chris

Attachment: pgpN8ixsYTL2F.pgp
Description: PGP signature


Reply to: