[Qt-creator] Link errors when building on linux
Christian Kandeler
christian.kandeler at qt.io
Thu Oct 26 10:10:15 CEST 2017
On Wed, 25 Oct 2017 22:06:10 -0500
Frank Miller <cfrankmiller at gmail.com> wrote:
> I'm new to qt-creator and would like to build from the source on linux
> but I am experiencing a curious linker error. I get the same error on
> the 4.3, 4.4, 4.5, and master git branches. The error message looks like
> this:
>
> .obj/release-shared/projectexplorer.o: In function
> `ProjectExplorer::ProjectExplorerPlugin::initialize(QStringList const&,
> QString*)':
> projectexplorer.cpp:(.text+0x216f): undefined reference to
> `ProjectExplorer::Internal::WinDebugInterface::WinDebugInterface(QObject*)'
> projectexplorer.cpp:(.text+0x2196): undefined reference to
> `ProjectExplorer::Internal::MsvcToolChainFactory::MsvcToolChainFactory()'
> collect2: error: ld returned 1 exit status
>
> I would be happy to provide the usual system details like OS, compiler,
> Qt version, and so on but I don't think its relevant. The error is quite
> easy to understand. The projectexplorer.pro file lists cpp files that
> are only built on windows
... or if the TEST environment variable is set.
> but code from the corresponding headers is referenced on any OS.
Yes, you are right. It seems commit 4b8564cb42 introduced this issue. Note that that commit is also conceptually wrong, as the target system is relevant for the choice which functionality to include, not the host. For instance, if you built Creator with mingw on Linux (which we don't do), then MSVC support would be missing from the resulting binaries.
As to why the build breakage does not seem to occur to anyone else: I'd assume the compiler optimizes out the code paths where the Msvc* is accessed, as it can determine statically that the conditions evaluate to false. No idea why it doesn't do that on your system, though.
> Here is a change that I made to fix the issue.
Any chance for you to push it to gerrit?
Christian
More information about the Qt-creator
mailing list