aboutsummaryrefslogtreecommitdiffstats
path: root/INSTALL_win.txt
blob: e64599007455a6b1b5d2e17056399bc7da68e250 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
// Copyright (C) 2024 The Qt Company Ltd.


Qt License Service for Windows

This document describes how to build and install the Qt License Service by admins if there is
a need to do this by yourself.

Note, that the Qt (Online) Installer will install the Qt License Service automatically as an
on-demand service on behalf of the user.


----------  Prerequisites: ----------

Download & install these first as needed:

  - cmake
  - Perl (i.e. Strawberry Perl)
  - Netwide Assembler (NASM)
  - OpenSSL (static build)
  - Microsoft Windows SDK
  - MSVC


----------  Build OpenSSL: ----------

The Qt License Service uses the OpenSSL library, which needs to be built before
building the service sources. The Qt License Service is tested against 3.0.x version of OpenSSL.

1. Make sure you have installed Perl and NASM, and that those are available in your PATH

2. Fetch the sources from https://www.openssl.org/source/

  2.1 Extract the sources to, i.e. "C:\openssl\"

3. Configure the sources for static build:

  3.1 Open the developer command prompt for the MSVC version you are using
  3.2 Change directory to the extracted sources:
      > cd C:\openssl\
  3.3 Run the configure script:
      > perl Configure no-shared no-pinshared

4. Build OpenSSL

  4.1 In the developer command prompt, run:
      > nmake


----------  Qt License Service operating modes: ----------

The Qt License Service can operate in the following modes:

- Option 1: As a system service
  - Running always on the background and available for all users on the machine

- Option 2: On-demand start (user-space)
  - The service is launched automatically when a license reservation is required


----------  Build: ----------

Note that the configure/build relies on MSVC (not tested on mingw or others).

1. Start a command prompt

  Put "cmd" in the search box right next to the Windows start menu, right click on "Command Prompt"
  (that appears in the menu) and click "run as administrator". Command prompt should open now.

2. Export OPENSSL_ROOT_DIR variable pointing to the OpenSSL installation
  > set OPENSSL_ROOT_DIR=C:\openssl\

3. Start the build

  In the command prompt, start the build script by typing:
  > build_windows.bat

  3.1 In case the default CMake generator does not match the desired Visual Studio version,
      it can be added as a parameter to the build script:
      > build_windows.bat "Visual Studio 17 2022"

----------  Configure server address: ----------

1. Edit qtlicd.ini file

    1.1 $ cd deploy (created by the build_windows.bat)
    1.2 Edit the qtlicd.ini file
      - server_addr         # The address and port of the Qt License Server. The default one
                            # is the cloud instance hosted by Qt. If using on-prem server then
                            # set the address accordingly.
      - tcp_listening_port  # Change if the default value is not suitable when using the
                            # on-prem server


2. Copy the Qt License Service files to the destination path

  2.1 Open the command prompt as an administrator
  2.2 Go to the <project root>\deploy directory
  2.3 Copy the files
    > mkdir C:\"Program Files"\qtlicd
    > copy *.* C:\"Program Files"\qtlicd\


----------  Option 1: Install it as a system service: ----------

3. Install the service

  > C:\"Program Files"\qtlicd\qtlicd --install

  Possible error messages:
    "OpenSCManager failed (5)"     <<-- You're not an administrator, re-open the command prompt as
                                        administrator
    "CreateService failed (1073)"  <<-- Service is already installed/running. See below how to
                                        stop and delete the old service if you want to reinstall it
    "CreateService failed (1072)   <<-- Service is deleted but still running. Stop it from
                                        Windows Services

7. Starting/stopping the service

7.1 Graphical option
  7.1.1 In the Windows start menu search, type: "Services"
  7.1.2 An icon with the name "Services" should appear. Open it, and a list of system services
        should now be seen.
  7.1.3 Scroll down until you see "qtlicd". Click it to activate, and then click "Start the service"
        near the upper left corner of the window. From the same place, you also can stop it whenever
        needed.

7.2 CMD option
  Use the "sc" command to start and stop the service (from administrator command prompt):
  7.2.1 Start the service:
      > sc start qtlicd
  7.2.2 Check if the service is running:
      > sc query qtlicd
  7.2.3 Stop the service:
      > sc stop qtlicd


8. Uninstall

  8.1 From administrator command prompt, call the lidc as follows:
      > C:\"Program Files"\qtlicd\qtlicd --delete
  8.2 The qtlicd service disappears from the Windows Services and you now can do re-installation
      if needed.

  Note that this does NOT delete the program itself, it's still in its designated folder.
  To completely remove it, destroy the "C:\Program Files\qtlicd" directory and replace
  the qtmoc.exe and licheck.exe binaries with the originals.


----------  Option 2: Install it as an on-demand service: ----------

5. Copy the service configuration file qtlicd.ini in place for on-demand launch

    5.1 > mkdir C:\Users\<user>\AppData\Roaming\Qt\qtlicd
        > copy qtlicd.ini C:\Users\<user>\AppData\Roaming\Qt\qtlicd\

6. Register the qtlicd.exe executable for on-demand start

    6.1 > cd C:\"Program Files"\qtlicd
        > qtlicd.exe --register <optional arg to specify the source, e.g. "admin" or "john">

    6.2 You can verify that the registration succeeded
        > type C:\Users\<user>\AppData\Roaming\Qt\qtlicd\installations.ini


----------  Service logs: ----------

7. To view logs:

     See the logs file: C:\"Program Files"\qtlicd\qtlicd_log.txt


----------  Enable license reservations for Qt5 and Qt6: ----------

4. Install MOC wrapper (Qt5 and Qt6)

  Because the installation script does not know your Qt installation paths, you must set up the
  MOC wrapper (Something like C:\Qt\6.3.1\mingw_64\bin) for each Qt installation path you need
  the license check enabled for.

  4.1 > Qt5: cd <your Qt installation path>\bin
        Qt6: cd <your Qt installation path>\libexec
  4.2 > move moc.exe qtmoc.exe           <--- Name MUST be qtmoc.exe
  4.3 > mklink moc.exe "C:\Program Files\qtlicd\mocwrapper.exe"

5. Disable legacy license check (Qt5)

  In case you're using Qt5, you need to enable legacy support for its qmake licensing system
  by replacing the licheck binary with the provided one:

  (Still in <your Qt installation path>\bin):
  5.1 > move licheck.exe licheck_bak.exe    <---- Name it freely
  5.2 > mklink licheck.exe "C:\Program Files\qtlicd\licheck.exe"