[Interest] Static build of Qt - debug mode and plugins

Jakub Narolewski izowiuz at gmail.com
Sun Aug 25 09:25:50 CEST 2019


@Elvis Stansvik
That made CMake talk, thanks!

@Thiago Macieira
That was it, thank you very much :]

What confused me was that the program compiled fine in the release mode.
I made sure that CMake outputted makefiles related stuff and I then compared linking steps between modes:

// RELEASE
/usr/bin/c++   -flto -funroll-all-loops -pthread -O3 -g -DNDEBUG  -rdynamic 
CMakeFiles/mrserver_release.dir/src/Server/StatsManagerWorker.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/StatsManager.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Modes/GameMode.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Modes/DeathMatchGameMode.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/Room.cpp.o 
CMakeFiles/mrserver_release.dir/src/main.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/Client.cpp.o 
CMakeFiles/mrserver_release.dir/src/DataContainers/GameData.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/World.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/Database/SqlGameDataLoader.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/Events/ServerEvent.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Weapons/Projectile.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/PhysicsUpdater.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Objects/ItemBox.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Objects/Entity.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Modes/TeamGameMode.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Modes/Stats/DeathMatchStats.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/ContactListener.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/Events/EventSignaler.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/Events/ClientEvent.cpp.o 
CMakeFiles/mrserver_release.dir/src/Utilities/b2Separator.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/SlaveServer.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Objects/Car.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/AccountManager.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/Server.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Modes/Stats/GameModeStats.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Objects/Drone.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Road/RoadController.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Road/RoadTraveler.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/LoadoutManager.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Weapons/ZigZagProjectile.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Weapons/BounceProjectile.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Objects/HealthPack.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/TcpServer.cpp.o 
CMakeFiles/mrserver_release.dir/src/DataContainers/moc_GameData.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/moc_AccountManager.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/Database/moc_SqlGameDataLoader.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/Events/moc_EventSignaler.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/moc_Room.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/moc_TcpServer.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/moc_Server.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/moc_LoadoutManager.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/moc_StatsManager.cpp.o 
CMakeFiles/mrserver_release.dir/src/Server/moc_StatsManagerWorker.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/Modes/moc_GameMode.cpp.o 
CMakeFiles/mrserver_release.dir/src/World/moc_World.cpp.o  -o mrserver_release 
/usr/local/Qt-5.13.0/lib/libQt5Core.a 
/usr/local/Qt-5.13.0/lib/libQt5Sql.a 
/usr/local/Qt-5.13.0/lib/libQt5Network.a 
/usr/local/Qt-5.13.0/lib/libQt5Concurrent.a 
/usr/local/Qt-5.13.0/lib/libQt5WebSockets.a
/home/izowiuz/vcpkg/installed/x64-linux/lib/libBox2D.a 
/usr/local/Qt-5.13.0/plugins/sqldrivers/libqsqlpsql.a 
/usr/local/Qt-5.13.0/plugins/sqldrivers/libqsqlite.a
-lpq
/home/izowiuz/vcpkg/installed/x64-linux/lib/liblz4.a 
/usr/local/Qt-5.13.0/lib/libQt5Network.a 
/usr/local/Qt-5.13.0/lib/libQt5Core.a -lpthread 
/usr/local/Qt-5.13.0/lib/libQt5Network.a 
/usr/local/Qt-5.13.0/lib/libQt5Core.a -lm 
/usr/local/Qt-5.13.0/lib/libqtpcre2.a -ldl -lssl -lcrypto 

// DEBUG
/usr/bin/c++  -g  -rdynamic 
CMakeFiles/mrserver_debug.dir/src/Server/StatsManagerWorker.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/StatsManager.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Modes/GameMode.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Modes/DeathMatchGameMode.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/Room.cpp.o 
CMakeFiles/mrserver_debug.dir/src/main.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/Client.cpp.o 
CMakeFiles/mrserver_debug.dir/src/DataContainers/GameData.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/World.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/Database/SqlGameDataLoader.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/Events/ServerEvent.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Weapons/Projectile.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/PhysicsUpdater.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Objects/ItemBox.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Objects/Entity.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Modes/TeamGameMode.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Modes/Stats/DeathMatchStats.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/ContactListener.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/Events/EventSignaler.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/Events/ClientEvent.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Utilities/b2Separator.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/SlaveServer.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Objects/Car.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/AccountManager.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/Server.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Modes/Stats/GameModeStats.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Objects/Drone.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Road/RoadController.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Road/RoadTraveler.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/LoadoutManager.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Weapons/ZigZagProjectile.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Weapons/BounceProjectile.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Objects/HealthPack.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/TcpServer.cpp.o 
CMakeFiles/mrserver_debug.dir/src/DataContainers/moc_GameData.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/moc_AccountManager.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/Database/moc_SqlGameDataLoader.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/Events/moc_EventSignaler.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/moc_Room.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/moc_TcpServer.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/moc_Server.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/moc_LoadoutManager.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/moc_StatsManager.cpp.o 
CMakeFiles/mrserver_debug.dir/src/Server/moc_StatsManagerWorker.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/Modes/moc_GameMode.cpp.o 
CMakeFiles/mrserver_debug.dir/src/World/moc_World.cpp.o  -o mrserver_debug 
/usr/local/Qt-5.13.0/lib/libQt5Core.a 
/usr/local/Qt-5.13.0/lib/libQt5Sql.a 
/usr/local/Qt-5.13.0/lib/libQt5Network.a 
/usr/local/Qt-5.13.0/lib/libQt5Concurrent.a 
/usr/local/Qt-5.13.0/lib/libQt5WebSockets.a
/home/izowiuz/vcpkg/installed/x64-linux/debug/lib/libBox2D.a 
/usr/local/Qt-5.13.0/plugins/sqldrivers/libqsqlpsql.a 
/usr/local/Qt-5.13.0/plugins/sqldrivers/libqsqlite.a
-lpq
/home/izowiuz/vcpkg/installed/x64-linux/debug/lib/liblz4d.a 
/usr/local/Qt-5.13.0/lib/libQt5Network.a 
/usr/local/Qt-5.13.0/lib/libQt5Core.a -lpthread 
/usr/local/Qt-5.13.0/lib/libQt5Network.a 
/usr/local/Qt-5.13.0/lib/libQt5Core.a -lm 
/usr/local/Qt-5.13.0/lib/libqtpcre2.a -ldl -lssl -lcrypto 

In both cases I see that /usr/local/Qt-5.13.0/lib/libQt5Sql.a is listed before SQL plugins: libqsqlite.a and libqsqlpsql.a
Nevertheless, when I changed the order of plugins and Qt's Sql component application started building properly in Debug mode.

Thank you!

Narolewski Jakub

From: Elvis Stansvik
Sent: 25 August 2019 09:09
To: Thiago Macieira
Cc: interest at qt-project.org Interest
Subject: Re: [Interest] Static build of Qt - debug mode and plugins

Den sön 25 aug. 2019 kl 02:56 skrev Thiago Macieira <thiago.macieira at intel.com>:
>
> On Saturday, 24 August 2019 10:53:45 PDT Jakub Narolewski wrote:
> > [  1%] Linking CXX executable mrserver_debug
>
> Please expand this line.

Jakub, to do this you can pass -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE to CMake.

Elvis

> Since this is a static build, the order in which the
> libraries is listed matters.
>
> Make sure that you list the plugin before the QtSql library.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel System Software Products
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
_______________________________________________
Interest mailing list
Interest at qt-project.org
https://lists.qt-project.org/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190825/32d0e9bd/attachment.html>


More information about the Interest mailing list