static linking/deployment?
hi! i'm trying to deploy my qt6 app but I cant really find out how i'm meant to deploy it. am i meant to statically link QT or make the user install qt6-devel. if i do need to statically link qt, how would i do that with cxx-qt?
This is ultimately a Qt deployment question, on some platforms you have tools such as on Windows there is windeployqt or on Linux there is linuxdeployqt. These scan the binary and bundle the required libraries into a package such as an exe or appimage.
If you are using CMake to build you application then this will be performed as normal as from a CMake perspective this is just a normal Qt executable, here you could also decide whether you want to link statically or dynamically etc.
If you are using Cargo we do not specify the rustc-link-lib kind which means by default it tries to link dynamically except when building a static executable.
Note that for a static build to work you'll also need to have installed Qt with static libraries available and follow any of the legal implications of this.
https://doc.qt.io/qt-6/deployment.html https://doc.qt.io/qt-6/windows-deployment.html
Does that mean there's no way to statically link via cargo without linuxdeployqt?
You may need to use a static target platform such as x86_64-unknown-linux-musl to trigger the "except when building a static executable." part of https://doc.rust-lang.org/rustc/command-line-arguments.html#option-l-link-lib
But I believe that the macOS builds when we have been using vcpkg are statically linking to Qt, as that vcpkg build of Qt is a static build that provides no dynamic libraries to link to. So that is the other route, have a version of Qt that is only only providing .a's.
Otherwise could be an option to add to CxxQtBuilder in the refactor to explicitly pass static to rustc-link-lib lines, cc @LeonMatthesKDAB
Yeah, sounds like we should make that a goal for 0.8
Yeah, sounds like we should make that a goal for 0.8
sounds good, thank you all!!
Lets leave this issue open to track that change for 0.8 :-)