[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-frameworks-devel
Subject:    Re: KConfig issues prevent compiling KDE applications under Windows
From:       Jaroslaw Staniek <staniek () kde ! org>
Date:       2017-02-02 21:08:53
Message-ID: CAOj7QQ1SO7uUzMw9B4QTdY12W-bLuvdKcG8RSv8m_C3g4DuJ3A () mail ! gmail ! com
[Download RAW message or body]

On 1 February 2017 at 14:34, David Faure <faure@kde.org> 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 <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@KEntryMap@@QEAA?AVite
> rator@?$QMap@UKEntryKey@@UKEntry@@@@AEBVQByteArray@@0V?
> $QFlags@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.


Hi,
Apparently it is since eab822e20620 (Jan 15).
​The bug #​375654 does not seem to provide version info but the fix isn't
just released, right? CC'd Stephen Kelly.

I don't see much to blame MSVS for here, even the message is rather clear:
the binary being linked (not compiled) already contains the symbol.
I'd avoid hacks such as (kconfig/autotests/CMakeLists.txt):

set(kentrymaptest_SRCS kentrymaptest.cpp ../src/core/kconfigdata.cpp)

Now since eab822e20620 the class is exported and all the other symbols are
inline so the hack isn't needed. Anyone, feel free make a general fix.

PS: The topic isn't linker-dependent, just the Microsoft's linker
demonstrated consequences of the hack.
Going further for quality, exporting just for test is suboptimal so it's a
good practice to export only for tests this way by using special macros:

Calligra for many years: https://api.kde.org/bundled-ap
ps-api/calligra-apidocs/libs/main/html/komain__export_8h_source.html

KDb: https://cgit.kde.org/kdb.git/tree/src/config-kdb.h.cmake#n43

I'd recommend this not just for frameworks (or do we have this in ECM
already?).
Obviously CMake's generate_export_header() does not support it but IMHO it
would.
Then the extra cmake conditions would not be needed.

​So maybe that would be even better fix for KConfigData tests.​



> This is something we do in quite a number of other places too,
> always for autotests.
>
> 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_expo
> rt.h
> for an example.
>
> --
> David Faure, faure@kde.org, http://www.davidfaure.fr
> Working on KDE Frameworks 5
>
>


-- 
regards, Jaroslaw Staniek

KDE:
: A world-wide network of software engineers, artists, writers, translators
: and facilitators committed to Free Software development - http://kde.org
Calligra Suite:
: A graphic art and office suite - http://calligra.org
Kexi:
: A visual database apps builder - http://calligra.org/kexi
Qt Certified Specialist:
: http://www.linkedin.com/in/jstaniek

[Attachment #3 (text/html)]

<div dir="ltr"><div class="gmail_default" \
style="font-family:monospace,monospace;font-size:small"><br></div><div \
class="gmail_extra"><br><div class="gmail_quote">On 1 February 2017 at 14:34, David \
Faure <span dir="ltr">&lt;<a href="mailto:faure@kde.org" \
target="_blank">faure@kde.org</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">On mardi 31 janvier 2017 07:58:15 CET Jasem Mutlaq \
wrote:<br> &gt; Hello,<br>
&gt;<br>
&gt; KConfig used to work perfectly fine under Windows. I recently tried to<br>
&gt; compile KStars under Windows 10 (64bit) with MSVC 2015 and Qt 5.8 using<br>
&gt; Craft, but encountered an issue as explained in this bug report:<br>
&gt;<br>
&gt; <a href="https://bugs.kde.org/show_bug.cgi?id=375654" rel="noreferrer" \
target="_blank">https://bugs.kde.org/show_bug.<wbr>cgi?id=<div \
style="font-family:monospace,monospace;font-size:small;display:inline" \
class="gmail_default">​​</div>375654</a><br> &gt;<br>
&gt; I talked with Craft maintainers (Hannah et al) and they told me this was an<br>
&gt; issue from KConfig side, not Craft. Can someone please look into this and<br>
&gt; fix it as it our release is dependent on this.<br>
<br>
KF5ConfigCore.lib(KF5ConfigCor<wbr>e.dll) : error LNK2005: &quot;public: class \
QMap&lt;struct<br> KEntryKey,struct KEntry&gt;::iterator __cdecl \
KEntryMap::findEntry(class<br> QByteArray const &amp;,class QByteArray const \
&amp;,class QFlags&lt;enum<br> KEntryMap::SearchFlag&gt;)&quot; \
(?findEntry@KEntryMap@@QEAA?AV<wbr>ite<br> \
rator@?$QMap@UKEntryKey@@UKEnt<wbr>ry@@@@AEBVQByteArray@@0V?<br> \
$QFlags@W4SearchFlag@KEntryMap<wbr>@@@@@Z)<br> already defined in \
kconfigdata.cpp.obj<br> <br>
Thanks MSVC for a very readable error message as always ;)<br>
<br>
One note though: this is a failure to link a unittest, your release isn&#39;t<br>
blocked, you can just disable the building of unittests in kconfig.<br>
<br>
The double definition can be explained, the unittest links to KF5ConfigCore<br>
and then also compiles in ../src/core/kconfigdata.cpp because that class is not<br>
exported. </blockquote><div><br><div \
style="font-family:monospace,monospace;font-size:small" \
class="gmail_default">Hi,<br>Apparently it is since eab822e20620 (Jan 15).<br>​The \
bug #​375654<span class="m_5355384135402510255m_-6004234993364865412gmail-"> does \
not seem to provide version info but the fix isn&#39;t just released, right? \
</span>CC&#39;d Stephen Kelly.<br></div><div \
style="font-family:monospace,monospace;font-size:small" class="gmail_default"><span \
class="m_5355384135402510255m_-6004234993364865412gmail-"><br></span></div><div \
style="font-family:monospace,monospace;font-size:small" class="gmail_default">I \
don&#39;t see much to blame MSVS for here, even the message is rather clear: the \
binary being linked (not compiled) already contains the symbol. <br>I&#39;d avoid \
hacks such as (kconfig/autotests/CMakeLists.<wbr>txt):<br><br>set(kentrymaptest_SRCS \
kentrymaptest.cpp ../src/core/kconfigdata.cpp)<br><br></div><div \
style="font-family:monospace,monospace;font-size:small" class="gmail_default">Now \
since eab822e20620 the class is exported and all the other symbols are inline so the \
hack isn&#39;t needed. Anyone, feel free make a general fix.<br><br>PS: The topic \
isn&#39;t linker-dependent, just the Microsoft&#39;s linker demonstrated consequences \
of the hack. <br>Going further for quality, exporting just for test is suboptimal so \
it&#39;s a good practice to export only for tests this way by using special \
macros:<br><br>Calligra for many years: <a \
href="https://api.kde.org/bundled-apps-api/calligra-apidocs/libs/main/html/komain__export_8h_source.html" \
target="_blank">https://api.kde.org/bundled-ap<wbr>ps-api/calligra-apidocs/libs/<wbr>main/html/komain__export_8h_<wbr>source.html</a><br><br>KDb: \
<a href="https://cgit.kde.org/kdb.git/tree/src/config-kdb.h.cmake#n43" \
target="_blank">https://cgit.kde.org/kdb.git/t<wbr>ree/src/config-kdb.h.cmake#n43</a><br><br></div><div \
style="font-family:monospace,monospace;font-size:small" class="gmail_default">I&#39;d \
recommend this not just for frameworks (or do we have this in ECM \
already?).<br></div><div style="font-family:monospace,monospace;font-size:small" \
class="gmail_default">Obviously CMake&#39;s generate_export_header() does not support \
it but IMHO it would.<br></div><div \
style="font-family:monospace,monospace;font-size:small" class="gmail_default">Then \
the extra cmake conditions would not be needed.<br></div><br><div \
style="font-family:monospace,monospace;font-size:small" class="gmail_default">​So \
maybe that would be even better fix for KConfigData tests.​</div><br>  \
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex">This is something we do in quite a number of \
other places too,<br> always for autotests.<br>
<br>
kde-windows people, if you confirm there is no way to make this work<br>
(some linker flag maybe?), then I do see one solution: the one used by Qt (and<br>
konqueror), which is an export macro that only exports the class when<br>
compilation of autotests is enabled. See konqueror/src/konqprivate_expo<wbr>rt.h<br>
for an example.<br>
<span class="m_5355384135402510255m_-6004234993364865412gmail-HOEnZb"><font \
                color="#888888"><br>
--<br>
David Faure, <a href="mailto:faure@kde.org" target="_blank">faure@kde.org</a>, <a \
href="http://www.davidfaure.fr" rel="noreferrer" \
target="_blank">http://www.davidfaure.fr</a><br> Working on KDE Frameworks 5<br>
<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div \
class="m_5355384135402510255m_-6004234993364865412gmail_signature">regards, Jaroslaw \
Staniek<br><br>KDE:<br>: A world-wide network of software engineers, artists, \
writers, translators<br>: and facilitators committed to Free Software development - \
<a href="http://kde.org" target="_blank">http://kde.org</a><br>Calligra Suite:<br>: A \
graphic art and office suite - <a href="http://calligra.org" \
target="_blank">http://calligra.org</a><br>Kexi:<br>: A visual database apps builder \
- <a href="http://calligra.org/kexi" \
target="_blank">http://calligra.org/kexi</a><br>Qt Certified Specialist:<br>: <a \
href="http://www.linkedin.com/in/jstaniek" \
target="_blank">http://www.linkedin.com/in/jst<wbr>aniek</a></div> </div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic