KConfig issues prevent compiling KDE applications under Windows

Milian Wolff mail at milianw.de
Thu Feb 2 11:46:14 UTC 2017


On Mittwoch, 1. Februar 2017 14:34:37 CET David Faure wrote:
> On mardi 31 janvier 2017 07:58:15 CET Jasem Mutlaq wrote:
> > Hello,
> > 
> > KConfig used to work perfectly fine under Windows. I recently tried to
> > compile KStars under Windows 10 (64bit) with MSVC 2015 and Qt 5.8 using
> > Craft, but encountered an issue as explained in this bug report:
> > 
> > https://bugs.kde.org/show_bug.cgi?id=375654
> > 
> > I talked with Craft maintainers (Hannah et al) and they told me this was
> > an
> > issue from KConfig side, not Craft. Can someone please look into this and
> > fix it as it our release is dependent on this.
> 
> KF5ConfigCore.lib(KF5ConfigCore.dll) : error LNK2005: "public: class
> QMap<struct KEntryKey,struct KEntry>::iterator __cdecl
> KEntryMap::findEntry(class QByteArray const &,class QByteArray const
> &,class QFlags<enum
> KEntryMap::SearchFlag>)" (?findEntry at KEntryMap@@QEAA?AVite
> rator@?$QMap at UKEntryKey@@UKEntry@@@@AEBVQByteArray@@0V?
> $QFlags at W4SearchFlag@KEntryMap@@@@@Z)
> already defined in kconfigdata.cpp.obj
> 
> Thanks MSVC for a very readable error message as always ;)
> 
> One note though: this is a failure to link a unittest, your release isn't
> blocked, you can just disable the building of unittests in kconfig.
> 
> The double definition can be explained, the unittest links to KF5ConfigCore
> and then also compiles in ../src/core/kconfigdata.cpp because that class is
> not exported. This is something we do in quite a number of other places
> too, always for autotests.

This is a violation of ODR and thus undefined behavior. Afaik even with clang 
you can hit issues in such situations - I know I've seen this with clang on 
KDevelop.

> kde-windows people, if you confirm there is no way to make this work
> (some linker flag maybe?), then I do see one solution: the one used by Qt
> (and konqueror), which is an export macro that only exports the class when
> compilation of autotests is enabled. See konqueror/src/konqprivate_export.h
> for an example.

That should be done, imo.

Bye

-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170202/83f76936/attachment.sig>


More information about the Kde-frameworks-devel mailing list