Link to QT statically
-
wrote on 13 Jan 2018, 15:58 last edited by
is there how-to build QT binaries statically, I need to static link so i dont need to ship any QT binaries to windows, Mac-OS and linux.
-
wrote on 13 Jan 2018, 16:10 last edited by yuvaram
Hi @Khalid80
Project A should link Project B library statically.
In Project B
projectB.pro file add CONFIG += staticlibIn project A
projectA.pro file add LIBS += -L$$PWD/-lprojectA -
wrote on 13 Jan 2018, 16:24 last edited by
You'll need to compile Qt yourself. Just add the "-static" flag to the "configure" command line.
-
Hi
Please be aware that using Qt as static library requires you to
1: release the source code as open source
Or
own a Qt license.Also to use static on all platforms, you will need to build Qt as static lib on all platforms.
I used this for Qt5.7 and mingw
https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW -
wrote on 13 Jan 2018, 17:46 last edited by
Thanks all, is there any diff between building it on windows using MinGW and linux or Mac?
-
Thanks all, is there any diff between building it on windows using MinGW and linux or Mac?
-
wrote on 16 Jan 2018, 00:00 last edited by
yes, but I am talking about how to build QT statically on Linux or mac-os, @mrjj mention he did it for windows using https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW tutorial, is there any tutorial for Linux and macos?
-
yes, but I am talking about how to build QT statically on Linux or mac-os, @mrjj mention he did it for windows using https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW tutorial, is there any tutorial for Linux and macos?
-
@Khalid80
all the steps are common for all the platforms.
As specified earlier .pro file CONFIG is specified staticlib. -
@yuvaram I am talking on building the QT binaries as static libs, not linking my project statically. my project will link to QT static libraries, so I have to build all the QT statically
wrote on 17 Jan 2018, 15:11 last edited by@Khalid80 so far I built QT statically using https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW tutorial, and then I created a static lib (Core.a) which is linking statically to QT, after that I created a test app the link to core.a but getting Core.cpp:-1: error: undefined reference to `QArrayData::shared_null'.
-
@Khalid80 so far I built QT statically using https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW tutorial, and then I created a static lib (Core.a) which is linking statically to QT, after that I created a test app the link to core.a but getting Core.cpp:-1: error: undefined reference to `QArrayData::shared_null'.
-
wrote on 18 Jan 2018, 13:58 last edited by
I built all QT platform statically and I am linking for now to QT5Core and QT5Network
1/12