[dtardon at redhat.com: Re: windows and mergedlibs - help with debugging makefile]

David Tardon dtardon at redhat.com
Tue Nov 11 05:39:25 PST 2014

----- Forwarded message from David Tardon <dtardon at redhat.com> -----

Date: Tue, 11 Nov 2014 14:24:56 +0100
From: David Tardon <dtardon at redhat.com>
To: Noel Grandin <noel at peralex.com>
Subject: Re: windows and mergedlibs - help with debugging makefile
User-Agent: Mutt/1.5.23 (2014-03-12)


On Tue, Nov 11, 2014 at 02:21:48PM +0200, Noel Grandin wrote:
> HI
> I'm trying to get --merged-libs working on Windows again. I fixed one bug,
> but now I'm running into another with one of the unit tests.
> The weird thing is that it hits only one unit test, so it doesn't seem
> likely that this is a generic fault. But on the other hand there is nothing
> really special about this unit test.

> imerged.lib(mergedlo.dll) : error LNK2005: "public: __thiscall
> connectivity::ORowSetValue::ORowSetValue(void)"
> (??0ORowSetValue at connectivity@@QAE at XZ) already defined in CommonTools.o


The problem is

$(eval $(call gb_CppunitTest_use_library_objects,connectivity_commontools,dbtools))

in connectivity/CppunitTest_connectivity_commontools.mk. That links the
object files from dbtools library directly to the test (so the test can
use even non-exported symbols). But in merged-libs build, dbtools is a
part of merged, so the symbols are present twice, which the linker does
not like.

But I really do not know how to solve this generically. If a test uses
gb_CppunitTest_use_library_objects, it means that it _needs_ to call
non-exported symbols. So making it an empty operation in merged-libs
build (thus using the code from merged) would not work. We would need to
make the function to link objects from all libs that are part of merged
and auto-magically disable the linking with merged. But that is very
hand-wavy and I do not even know if it is even possible without severe
changes. It would also immensely inflate the disk space needs for
merged-libs build, of course.

A possible workaround is to identify which non-exported symbol(s) from
dbtools the test uses (you can find that easily by dropping the
gb_CppunitTest_use_library_objects call) and export it/them.


----- End forwarded message -----

David Tardon

More information about the LibreOffice mailing list