[Libreoffice-bugs] [Bug 47246] New: EasyHack: Remove the duplicate linked objects in gbuild

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Mar 12 11:33:43 PDT 2012


https://bugs.freedesktop.org/show_bug.cgi?id=47246

             Bug #: 47246
           Summary: EasyHack: Remove the duplicate linked objects in
                    gbuild
    Classification: Unclassified
           Product: LibreOffice
           Version: LibO Master
          Platform: Other
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Libreoffice
        AssignedTo: libreoffice-bugs at lists.freedesktop.org
        ReportedBy: bjoern.michaelsen at canonical.com


Duplicate linked objects are do not have to be a deadly problem, but they can
introduce very hard to debug problems. As we set stuff like compile flags and
include paths on the linktarget (aka the library) and in the above case the
object file is linked in by two libraries, the flags it is compiled with are
actually nondeterministic. That is Very Bad(tm)!

So the smoketest/smoketest.cxx will either be compiled with the CFLAGS of
Library/libsmoketest.so or with those of CppunitTest/libtest_smoketest.so --
actually it can be compiled different on different machines with the same code.
It can even be compiled different on the same machine! So again: This is Very
Bad(tm) and we should probably never ever have let that happen.

Now it might be possible that the one doing the initial migration carefully
checked that both libs are compiled exactly the same on all platforms (I highly
doubt that), but even then this totally unproof against future changes. Someone
might innocently add a define to the compile flags of one library and create a
terribly hard to reproduce heisenbug.

So this has to go, it should never have been there in the first place. How can
this be removed?

There are two possibilities:
a) create a smoketest/smoketest_libtest_smoketest.cxx with this content:

    #include "smoketest.cxx"

   and then use that file instead of smoketest/smoketest.cxx in
   CppunitTest/libtest_smoketest. That way, the object gets build twice (with
   possibly different flags and defines) and everything is fine.
   Ugly, but does the job.
b) create a static library smoketest and add the smoketest/smoketest.cxx to it.
   Now instead link that static library into both of the dynamic ones and
   everything is fine.

Once all the warnings are gone, we should probably make gbuild abort if it
detects one of those.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Libreoffice-bugs mailing list