-
Notifications
You must be signed in to change notification settings - Fork 18
/
static qt build notes.txt
100 lines (62 loc) · 4 KB
/
static qt build notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
These are the steps I took to compile Qt statically. I'm sure there are other ways too.
* Download and install QtSDK (MinGW version, I used 5.0.1)
* Download Qt sources (I used Qt 5.0.1) - i used the one bundled with qt creator
* Install a version of perl (I used strawberry perl)
* Install python
* Unpack Qt sources, e.g. in C:\Qt
* Edit C:\Qt\qt-everywhere-opensource-src-5.0.1\qtdeclarative\src\src.pro and change
<<<<<<<
!isEmpty(QT.gui.name) {
SUBDIRS += \
=======
qtHaveModule(gui):contains(QT_CONFIG, opengl(es1|es2)?) {
SUBDIRS += \
>>>>>>> Fixed build when Qt is configured with -no-opengl
Now we have to patch some makefiles: http://falsinsoft.blogspot.ca/2011/12/building-static-qt-on-windows-with.html
http://qt-project.org/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc
OK, now we need to make few changes in some files inside sources folder. Using Notepad.exe open the following file:
C:\Qt\qt-everywhere-opensource-src-x.x.x\mkspecs\win32-g++\qmake.conf
Search for the following line:
QMAKE_LFLAGS =
and change to (add -static -static-libgcc):
QMAKE_LFLAGS = -static -static-libgcc
Save and close. Now open and modify the following three files:
C:\Qt\qt-everywhere-opensource-src-x.x.x\qmake\Makefile.win32
C:\Qt\qt-everywhere-opensource-src-x.x.x\qmake\Makefile.win32-g++
C:\Qt\qt-everywhere-opensource-src-x.x.x\qmake\Makefile.win32-g++-sh
Same operation of above. Search for the following line:
LFLAGS = [other-params...]
and add the param -static-libgcc if is not already present (is possible that in the last two files of the list this param is already present). So the line will become:
LFLAGS = -static-libgcc [other-params...]
* Open "Qt 5.0.1 for Desktop (MinGW 4.7)". It's basically cmd.exe with some extra environment variables.
* Run
cd C:\path\to\qt
configure -static -release -opensource -nomake tools -nomake examples -no-accessibility -no-openvg -no-nis -no-iconv -no-inotify -no-fontconfig -qt-zlib -no-icu -no-gif -no-libjpeg -no-freetype -no-vcproj -strip -no-plugin-manifests -no-openssl -no-dbus -no-audio-backend -no-qml-debug -no-directwrite -no-native-gestures -no-mp -no-rtti -no-c++11 -no-opengl -system-zlib
mingw32-make
* wait for a shitlong while.
Using Qt creator:
* Open rasplex-installer project in Qt Creator
* Go to Tools->Options->Build & Run->Qt Versions and click add. Select
C:\Qt\qt-everywhere-opensource-src-5.0.1\qtbase\bin\qmake.exe
* Go to Tools->Options->Build & Run->Kits and clone the existing kit. Change Qt version of that kit to the static version.
* Apply and close Options
* Make rasplex-installer the active project and go to the Projects tab
* Click "Add kit" and select the new (static) clone
* Make sure that the build configuration is set to Release
* Build and prosper!
Or Using command line:
Make sure you are using the same qt mingw command line from before.
navigate to rasplex-installer directory, and run the qmake that you just built above by manually specifying its path (or make it part of build environment)
then just run mingw32-make
Compression:
Compress static stuff with
http://upx.sourceforge.net/#downloadupx
http://qt-project.org/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc#9a5f09cf66e692efdae493ce4c9aa64f
# OS X:
You can't really do a static build very easily... just use "macdeployqt"
to bundle for osx, use "macdeployqt" on the target app, and merge this with the GetRasplex.app included, generated from the main.scpt using applescript editor
Merge the two together with cp -r, and then drop in the info.plst and icon file. voila!
Bundle with http://dmgcreator.sourceforge.net/en/ to compress down to 10MB
# GNU/Linux:
(Qt-5.2.1)
$ ./configure -static -release -opensource -nomake tools -nomake examples -no-accessibility -no-openvg -no-nis -no-iconv -no-directfb -no-icu -no-gif -no-libjpeg -strip -no-dbus -no-audio-backend -no-qml-debug -no-c++11 -system-zlib -no-linuxfb -no-eglfs -no-sql-mysql -no-sql-odbc -system-sqlite -no-sql-sqlite2 -no-cups -no-glib -no-qml-debug -no-javascript-jit -no-mtdev