Solved Standalone Qt application -- Just to be sure...
-
@mrjj I just had a look at Lazarus (I used to program using Delphi / C++ Builder many years ago), but I have just seen that they don't support the system tray out of the box on Linux. Also, their IDE is really not great (compared with Qt Creator). So, that's not an option either.
As you said, I am already all set up with VMs, etc. so I might have a go at building a static version of Qt. I am just hoping that it's only going to be a matter of pressing a button and then wait for hours. Anything else might prove too much hassle for such a program.
-
@agarny
Oh, im old Delphi & Builder user and still Kylix user :)
Lazarus seems great but not as complete as Qt. It was however lovely to see VLC-(ish) again :)Its not so bad to compile a static. First google some good samples and it should be ok.
I never go around to test this script
https://gist.github.com/jakoch/ebab7ff300e76257a1bd
I was told just alter the download path it would do all for me. :)
But I wanted to learn.I think i spend 1 hour reading docs then just compiled it.
When there is no webkit classes involved its much easier.
If mac is your pref. Os, then maybe try there first just to see.
( i assume its linux like. Sorry never used macOS so it might be ok easy) -
Hi,
To add to @mrjj, "just adding" the static builds doubles the number of provided platforms which includes 3 different compilers only for the Windows version, then you add in Android which is available on the other desktop platforms as well and then iOS. And with all of that we don't take into account architecture.
All the provided packages are tested by people because not everything can be automatically tested.
The infrastructure building the package is the same that is already building Qt several times a day to incorporate all the validated submissions.That said for the size of the dependencies of your application, Qt 5.8 comes with a new configuration system that will make it easier to tune so you can include only what you need in your build.
-
@mrjj said in Standalone Qt application -- Just to be sure...:
Its not so bad to compile a static. First google some good samples and it should be ok.
I never go around to test this script
https://gist.github.com/jakoch/ebab7ff300e76257a1bd
I was told just alter the download path it would do all for me. :)I just had a quick look and it relies on MinGW while I use MSVC 2015. Still, it ought to get me started.
@SGaist said in Standalone Qt application -- Just to be sure...:
To add to @mrjj, "just adding" the static builds doubles the number of provided platforms which includes 3 different compilers only for the Windows version, then you add in Android which is available on the other desktop platforms as well and then iOS. And with all of that we don't take into account architecture.
All the provided packages are tested by people because not everything can be automatically tested.
The infrastructure building the package is the same that is already building Qt several times a day to incorporate all the validated submissions.That is all fine, it's just that I mentioned at some point: it doesn't make it easy for people who want to develop and distribute small applications.
That said for the size of the dependencies of your application, Qt 5.8 comes with a new configuration system that will make it easier to tune so you can include only what you need in your build.
Interesting, would you mind telling us more about this? Maybe a link or something?
-
@SGaist Ignore my request, I think I have found what I need: https://blog.qt.io/blog/2016/09/05/qt-5-8-alpha-released/ and http://blog.qt.io/blog/2016/08/18/introducing-the-qt-lite-project-qt-for-any-platform-any-thing-any-size/.
-
@agarny said in Standalone Qt application -- Just to be sure...:
I think I have found what I need
Yes, this is it.
-
FWIW, I have managed to build a static version of Qt 5.6.2 LTS on Windows, Linux and macOS. It was probably eased by the fact that I am already building QtWebKit (for another project, but I don't need it for this one). Anyway, and just in case, here is how I am building Qt 5.6.2 LTS:
Prerequisites:
- Download and extract Qt 5.6.2 from https://download.qt.io/official_releases/qt/5.6/5.6.2/single/.
- Windows: edit [Qt]/qtbase/mkspecs/common/msvc-desktop.conf by replacing:
QMAKE_CFLAGS_RELEASE = -O2 -MD QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi QMAKE_CFLAGS_DEBUG = -Zi -MDd
with:
QMAKE_CFLAGS_RELEASE = -O2 -MT QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi QMAKE_CFLAGS_DEBUG = -Zi -MTd
- Linux: make sure that FontConfig is installed (
libfontconfig1-dev
package on Ubuntu). - macOS: apply the patch at https://code.qt.io/cgit/qt/qtconnectivity.git/commit/?h=5.7.1&id=462323dba4f963844e8c9911da27a0d21e4abf43.
Windows:
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat" configure -prefix C:\Qt\Static -opensource -confirm-license -release -static -nomake libs -nomake tools -nomake examples jom jom install
Linux:
./configure -prefix /opt/Qt/Static -opensource -confirm-license -release -static -nomake libs -nomake tools -nomake examples -qt-xcb make -j 2 sudo make install
macOS:
./configure -prefix /Applications/Qt/Static -opensource -confirm-license -release -static -nomake libs -nomake tools -nomake examples make -j 4 make install
So, now, I am able to statically build my small application, which is perfect. So, thanks all for 'forcing' me into statically building Qt.
-
Thank you for the write up. That will surely come in handy.
Good luck with the app. -
@agarny said in Standalone Qt application -- Just to be sure...:
Hi,
I never had the need to do it until now, but from googling around (e.g. here), I get the feeling that a prerequisite to building a standalone application is furst ti build a static version of Qt. Is that really the case? If so, are there binaries for a static version of Qt that I could download for Windows, Linux and macOS?
Cheers, Alan.
It depends on what you mean by 'stand alone'. I consider stand alone to mean something that you can run without installing the application or other application dependencies. You don't need a static build to do this. If you want to have one executable file then this is when you need a static build.
The application size (sum of size of all required dll's or size of executable) can be large. In your case (45 mb) it sounds like you included the webkit icu dll's. If you build your own version of qt from the sources and exclude webkit you won't have these dependencies and should end up with something around 17 mb.
For a stand alone application (using my definition which means it doesn't need to be installed) you should not be using Visual Studio. You will likely need to install the VCRT distributable on every system that you run the program on. The user will end up with an error message when running on a system without the proper VCRT installed. If there is a way to change this behavior in Visual Studio I would like to know otherwise using MinGW is a better option.
-
@Rondog I don't actually use QtWebKit in this small application (I have edited my previous comment accordingly). I just meant that because I need to build QtWebKit for another project, I already have some other prerequisites installed (e.g. Perl, Python, Ruby, etc. on Windows).
Regarding a standalone application, I indeed meant that I am after one executable file and nothing else (i.e. no shared libraries having to be shipped with my application). This is what I have achieved and my application is ~15.4 MB on Windows, for example.
Finally, with regards to Visual Studio, it's actually all fine since Qt was built using
-MT
and not-MD
. As a result, all my application needs are systems DLLs: -
Just one thing to take into consideration when using the Visual Studio static runtime. When a new release is done, you're application won't benefit from it. So if there's a security issue found you should provide a new version of your application.