OSDN Git Service

Revise first-time installation instructions.
[mingw/website.git] / setup.html
1 <!DOCTYPE HTML><!--
2  *
3  * setup.html
4  *
5  * A guide to managed MinGW installation, for new users.
6  *
7  *
8  * $Id$
9  *
10 --><meta author="Julien Lecomte" /><!--
11  * Copyright (C) 2007, 2021, MinGW.org Project
12  *
13  *
14  * Redistribution and use in source and 'compiled' forms (SGML, HTML,
15  * PDF, PostScript, RTF, etc) with or without modification, are permitted
16  * provided that the following conditions are met:
17  *
18  * 1. Redistributions of source code must retain the above copyright
19  *    notice, this list of conditions and the following disclaimer as
20  *    the first lines of this file, unmodified.
21  *
22  * 2. Redistributions in compiled form (transformed to other DTDs,
23  *    converted to PDF, PostScript, RTF and other formats) must
24  *    reproduce the above copyright notice, this list of conditions
25  *    and the following disclaimer in the documentation and/or other
26  *    materials provided with the distribution.
27  *
28  * THIS DOCUMENTATION IS PROVIDED BY THE MINGW.ORG PROJECT "AS IS" AND
29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE MINGW.ORG PROJECT, OR
32  * ITS CONTRIBUTORS, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
39  * DAMAGE.
40  *
41  *
42  * Note: this page assumes browser support for the following numeric
43  * HTML entity codes:
44  *
45  *    &#8209;   non-breaking hyphen
46  *    &#8216;   typographic left (opening) single quote
47  *    &#8217;   typographic apostrophe/right (closing) single quote
48  *    &#8220;   typographic left (opening) double quote
49  *    &#8221;   typographic right (closing) double quote
50  *
51 -->
52 <style>
53 div.h3-numbered ul { margin-left: -0.7em; }
54 div.h3-numbered li > p + ul { margin-top: -0.3em; }
55 div.h3-numbered p + ul { margin-top: 0.1em; }
56
57 span.smaller { font-size: 0.9em; }
58 pre.vt em::after { content: "&nbsp;"; font-size: 0.4pt; }
59
60 ol.setup-steps { list-style: lower-roman; }
61 ol.setup-steps > li:first-child { margin-top: 0; }
62 ol.setup-steps div.desc { width: calc( 65% - 2em ); }
63 ol.setup-steps > li { clear: both; margin-top: 1.0em; }
64 ol.setup-steps img { width: 35%; float: right; margin: 0.2em 0 0 2em; }
65 ol.setup-steps ol { list-style: number; margin: 0 0 0 -0.85em; }
66 ol.setup-steps ul { list-style: disc; margin: 0 0 0 -0.7em; }
67 ol.setup-steps ol > li::marker { font-size: 0.75em; }
68 ol.setup-steps div.desc li { margin-right: 0; }
69 ol.setup-steps p { margin-top: 0.4em; }
70
71 ol.config-options { margin-left: -0.5em; }
72 ol.config-options > li { margin-top: 0.4em; }
73 ol.config-options > li::marker { font-size: 0.85em; }
74 ol.config-options ul + p { margin-top: 0.3em; }
75 ol.config-options ul { list-style: disc; }
76
77 div.step-ref { clear: both; position: relative; top: -70px; height: 70px; }
78 div.step-ref + li { margin-top: calc( 1.0em - 70px ); }
79 </style>
80 <script class="masthead">
81 /* Script fragment, to assign titles specific to this page; this is
82  * encapsulated within the "masthead", where such titles are displayed,
83  * to ensure that whatever page content may follow will be correctly
84  * positioned, relative to the masthead content.
85  */
86  set_page("title", "Getting Started with MinGW");
87  set_page("subtitle",
88     "HOWTO Set Up the MinGW Compiler Suite &mdash; a Guide for New Users"
89   );
90 </script><!-- masthead -->
91
92 <p>This HOWTO document provides instructions,
93 and recommendations, both for first&#8209;time installation,
94 and subsequent maintenance of the MinGW (GCC) compiler suite,
95 and ancillary MinGW applications and/or tools;
96 the recommended method of installation is suitable
97 for <em>all</em>&hairsp; users,
98 regardless of experience,
99 or level of expertise.
100 </p>
101 <p><strong><em>Caution</em></strong>&hairsp;:
102 MinGW may have problems with paths containing spaces, and if not,
103 other programs used with MinGW may often experience problems with such paths.
104 Thus, we <strong><em>strongly recommend</em></strong>&hairsp; that you
105 <strong><em>do not install MinGW in any location
106 with spaces in the absolute path name</em></strong>&hairsp;;
107 you should avoid installing into any directory or subdirectory
108 having names like <code>&quot;Program</code>&#8197;<code>Files&quot;</code>
109 or <code>&quot;My</code>&#8197;<code>Documents&quot;</code>, etc.
110 </p>
111 <p>The preferred installation target directory,
112 its path name having been chosen to comply with the preceding recommendation,
113 is <code><strong>C:\MinGW</strong></code>
114 </p>
115 <p>The preferred installation method is using
116 the <code>mingw-get</code> &#8220;Installation Manager&#8221; tool,
117 <a href="#start-here">as described below</a>.
118 While a manual installation is possible,
119 we recommend it only for expert users,
120 unless you have a very old version of MS&#8209;Windows,
121 which is unable to run the GUI variant of <code>mingw&#8209;get</code>.
122 If you really want (or need) to resort to it,
123 instructions for manual installation are provided in
124 <a target="_blank" href="index.html?page=install.html"
125 >this alternative HOWTO document</a>.
126 </p>
127 <p>After installation,
128 you may need to perform some additional system configuration tasks yourself,
129 to ensure your MinGW applications will run.
130 Most importantly,
131 you may need to set up <code>Start</code>&#8197;<code>Menu</code>,
132 or <code>Desktop</code> &#8220;short&#8209;cuts&#8221;,
133 to launch a suitable command line interpreter session,
134 with appropriate environment variable settings,
135 (notably, the <code>PATH</code> setting),
136 for running MinGW applications;
137 further details may be found in the
138 <a href="#post-install">post&#8209;installation section</a>,
139 below.
140 </p>
141 <p>Ultimately,
142 having completed installation and configuration,
143 you will wish to perform occasional maintenance tasks,
144 perhaps to install additional packages,
145 and certainly to install software updates,
146 and so keep your installation up&#8209;to&#8209;date;
147 suitable maintenance procedures are discussed in
148 <a href="#maintenance">the final section</a>
149 of this document.
150 </p>
151
152 <div class="h3-numbered">
153 <div class="overlapped" id="start-here">
154 <h3>Setting Up the MinGW Installation Manager for First&#8209;Time Use</h3>
155 <p>The first step,
156 in the recommended procedure for creating a new MinGW installation,
157 is to install the <code>mingw-get</code> installer itself;
158 this can be most readily accomplished by downloading,
159 and subsequently running,
160 <a rel="noopener noreferrer" target="_blank"
161  href="https://osdn.net/dl/mingw/mingw-get-setup.exe"
162 >the GUI <code>mingw&#8209;get&#8209;setup.exe</code> tool</a>.
163 </p>
164 <p>If you have previously installed <code>mingw&#8209;get</code>,
165 and your objective is to upgrade, or to extend,
166 its associated (existing) MinGW installation,
167 then you should <em>not</em> run <code>mingw&#8209;get&#8209;setup.exe</code> again;
168 you <em>should</em> simply run <code>mingw&#8209;get.exe</code>, and
169 <a href="#install-packages">proceed directly to the next installation phase</a>.
170 </p>
171 <p>If do wish to run <code>mingw&#8209;get&#8209;setup.exe</code>,
172 and you already have a local copy,
173 we <em>strongly</em> recommend that you check its publication date,
174 to ensure that it is no older than the current release,
175 <a rel="noopener noreferrer"
176  target="_blank" href="https://osdn.net/projects/mingw"
177 >as identified at https://osdn.net/projects/mingw</a>;
178 you should <em>always</em> run the most recent release of
179 <code>mingw&#8209;get&#8209;setup.exe</code>,
180 so please download a replacement copy,
181 if yours is out of date.
182 </p>
183 <p>When you <em>do</em> choose to run
184 <code>mingw&#8209;get&#8209;setup.exe</code>,
185 you should follow this sequence of steps:&ndash;
186 </p>
187 <ol class="setup-steps">
188 <li><img src="https://static-cdn.osdn.net/thumb/g/5/213/800x600_0.png"
189  alt="Installer Setup &mdash; Opening Dialogue"
190 /><div class="desc">
191 Depending on your MS&#8209;Windows version,
192 and its system security policy configuration,
193 you may be able to invoke <code>mingw&#8209;get&#8209;setup.exe</code>
194 directly from the <a rel="noopener noreferrer"
195  target="_blank" href="https://osdn.net/dl/mingw/mingw-get-setup.exe"
196 >download link specified above</a>;
197 alternatively, you may need to save a local copy,
198 locate it in the file&#8209;system explorer,
199 and double&#8209;click to invoke it.
200 In either case, and again depending on Windows version,
201 and security policy configuration,
202 you may need to authorize execution of
203 <code>mingw&#8209;get&#8209;setup.exe</code>,
204 and the changes it will make to your system,
205 after which you should see a dialogue similar
206 to that depicted to the right.
207 <p>When you see this dialogue,
208 we advise you to acquaint yourself with the content
209 of the warranty disclaimer, and additional &#8220;blurb&#8221;,
210 which appears below the copyright notice;
211 you may also wish to review the licensing terms,
212 which will be displayed in a web browser window,
213 if you click the <code>View</code>&#8197;<code>Licence</code> button.
214 </p>
215 <p>When you are ready to proceed,
216 click the <code>Install</code> button to move on to the next step;
217 alternatively, you may click the <code>Cancel</code> button
218 to abandon the installation process.
219 </p>
220 </div><!-- ol.setup-steps desc -->
221 </li>
222 <div class="step-ref" id="step-1-ii"></div>
223 <li><img src="https://static-cdn.osdn.net/thumb/g/5/214/800x600_0.png"
224  alt="Installer Setup &mdash; Preferences Dialogue"
225 /><div class="desc">
226 On progressing from the opening dialogue,
227 by clicking on the <code>Install</code> button
228 as stipulated in the preceding step,
229 you will be presented with a new dialogue,
230 as depicted to the right.
231 Here, you have the opportunity to select from
232 a set of optional configuration attributes for
233 your <code>mingw&#8209;get</code> installation,
234 and for the associated MinGW installation,
235 which you will use it to manage.
236 <p>You may observe, when this dialogue is opened,
237 that the installation directory is specified, by default,
238 to be <code>C:\MinGW</code>.
239 We <em>strongly</em> recommend that you leave this
240 at its default setting,
241 <em>except</em> in the particular cases where:&ndash;
242 <ul><li>Your system policy forbids installation into a directory
243 at this level within the file&#8209;system hierarchy,
244 and you are unable to obtain authorization for an exception
245 to such a policy.
246 </li>
247 <li>You require an alternative installation root directory,
248 for the purpose of creating <em>side&#8209;by&#8209;side</em>
249 MinGW sandbox installations.
250 </li></ul>
251 <p>If you do choose to change the installation directory,
252 you may click the <code>Change</code> button to open
253 a standard file&#8209;system navigation dialogue,
254 whence you may select, or create, an alternative directory;
255 <em>do</em> please heed the warning about avoiding any
256 directory name, which introduces white&#8209;space into
257 its absolute path name.
258 </p>
259 <p>Other installation options, which you may select via this dialogue,
260 include:&ndash;
261 </p>
262 <ul><li>Installation of the <code>mingw&#8209;get</code> GUI application,
263 in addition to the CLI version, (which is <em>always</em> installed).
264 </li>
265 <li>Installation of Windows &#8220;shortcuts&#8221;,
266 either on the desktop,
267 or in the Windows <code>Start</code>&nbsp;<code>Menu</code>, (or both),
268 for either the current user only (<em>strongly</em> recommended),
269 or for all users;
270 (if installed, these will launch the <code>mingw&#8209;get</code>
271 GUI client, and thus are effective only if that is installed).
272 </li></ul>
273 <p>Once you have specified your choice of installation root directory,
274 and completed your selection of installation options,
275 you may click the <code>Continue</code> button,
276 to proceed to the next step &mdash; the actual installation
277 of <code>mingw&#8209;get</code>.
278 </p>
279 </div><!-- ol.setup-steps desc -->
280 </li>
281 <li><img src="https://static-cdn.osdn.net/thumb/g/5/215/800x600_0.png"
282  alt="Installer Setup &mdash; Download Dialogue"
283 /><div class="desc">
284 Your computer <em>must</em> remain actively connected to the internet,
285 throughout this step, which should proceed <em>without</em> user intervention.
286 <p>While the process proceeds, you should observe a dialogue similar to
287 that depicted to the right; the data displayed will be dynamically
288 updated, as the constituent packages of <code>mingw&#8209;get</code>
289 are downloaded from the MinGW.org on&#8209;line file store,
290 and installed locally, into your designated installation directory tree.
291 </p>
292 <p>You may observe that,
293 while download and installation are in progress,
294 the <code>Continue</code> and <code>Quit</code>
295 buttons are <em>disabled</em>;
296 they will be <em>enabled</em>, only when the process completes.
297 </p>
298 <p>If errors occur, during the download and installation process,
299 only the <code>Quit</code> button will be <em>enabled</em>,
300 allowing you to terminate <code>mingw&#8209;get&#8209;setup.exe</code>;
301 please <a target="_blank"
302  href="index.html?page=faq.html#troubleshoot-installation"
303 >consult the FAQ</a>, or <a target="_blank"
304  href="index.html?page=mailing.html#mingw-users"
305 >seek advice via the mailing list</a>,
306 for assistance to troubleshoot, and resolve the errors,
307 <em>before</em> running <code>mingw&#8209;get&#8209;setup.exe</code> again.
308 </p>
309 <p>When the download and installation of <code>mingw&#8209;get</code>
310 completes successfully, <em>both</em> the <code>Continue</code>,
311 <em>and</em> the <code>Quit</code> buttons will be <em>enabled</em>.
312 At this point, you may choose to:&ndash;
313 </p>
314 <ul><li>Click the <code>Continue</code> button,
315 to terminate <code>mingw&#8209;get&#8209;setup.exe</code>,
316 and <em>immediately</em> start <code>mingw&#8209;get</code> in GUI mode;
317 (note that the <code>mingw&#8209;get</code> GUI is available at this point,
318 at least temporarily, even if you chose not to install it permanently).
319 </li>
320 <li>Click the <code>Quit</code> button,
321 to terminate <code>mingw&#8209;get&#8209;setup.exe</code>
322 <em>without</em> starting <code>mingw&#8209;get</code>;
323 (you may resume installation of MinGW later,
324 by running stand&#8209;alone <code>mingw&#8209;get</code>,
325 either in CLI mode,
326 or &mdash; if you chose to install it as a permanent capability &mdash;
327 in GUI mode).
328 </li></ul>
329 <p>Regardless of which of the preceding options you choose,
330 <code>mingw&#8209;get&#8209;setup.exe</code> has completed its task;
331 when you proceed to the next stage of the installation process,
332 you will be running <code>mingw&#8209;get</code>,
333 <em>not</em>&hairsp; <code>mingw&#8209;get&#8209;setup.exe</code>.
334 </p>
335 </div><!-- ol.setup-steps desc -->
336 </li></ol>
337 </div><!-- start-here -->
338
339 <div style="clear: both"></div>
340 <div class="overlapped" id="install-packages">
341 <h3>Using the MinGW Installation Manager to Install Packages</h3>
342 <p>Once you have completed the installation of
343 <code><strong>mingw&#8209;get</strong></code>,
344 (which is also known,
345 particularly in its GUI guise,
346 as the &#8220;MinGW Installation Manager&#8221;),
347 you may use it to proceed with the installation of your choice of packages,
348 to complete (or subsequently extend) your MinGW installation.
349 Assuming that you have started the GUI variant of <code>mingw&#8209;get</code>,
350 either (having chosen to install it
351 at <a href="#step-1-ii">step ii of the set up procedure</a>)
352 as a free&#8209;standing application,
353 or by continuation from within <code>mingw&#8209;get&#8209;setup.exe</code>,
354 you will be presented with a three&#8209;paned window display,
355 whence you may proceed as follows:&ndash;
356 </p>
357 <ol class="setup-steps">
358 <li><img src="https://static-cdn.osdn.net/thumb/g/7/709/800x600_0.png"
359  alt="Installer &mdash; Basic Package View"
360 /><div class="desc">
361 When <code>mingw&#8209;get</code> is invoked as a continuation
362 of <code>mingw&#8209;get&#8209;setup.exe</code>,
363 the initial three&#8209;paned view will appear as on the right;
364 (alternatively,
365 this view may be accessed by selecting
366 the <code>Basic</code>&#8197;<code>Setup</code>
367 option in the left&#8209;hand window pane,
368 at any time,
369 regardless of whether <code>mingw&#8209;get</code> is running
370 as a continuation of <code>mingw&#8209;get&#8209;setup.exe</code>,
371 or as a free&#8209;standing application).
372 <p>Within this view,
373 you will see a list (in the upper right&#8209;hand pane) of those packages
374 which are likely to be of most interest to first&#8209;time MinGW users;
375 you may select any one of these packages,
376 to see related package information on the tabs of
377 the lower right&#8209;hand pane,
378 and,
379 by clicking on the small square button,
380 to the left of any selected package entry,
381 you may choose (from its context menu) to mark one (or more) packages,
382 which you would like to install ...
383 for first&#8209;time users,
384 we recommend that you elect to install,
385 at least,
386 the <code>mingw32&#8209;base&#8209;bin</code> package,
387 (which comprises the C compiler and essential ancillary tools);
388 if you require a C++ compiler,
389 in addition to the C compiler,
390 you should also elect to install
391 the <code>mingw32&#8209;g++&#8209;bin</code> package.
392 </div><!-- ol.setup-steps desc -->
393 </li>
394 <div style="clear: both"></div>
395 <li><img src="https://static-cdn.osdn.net/thumb/g/7/710/800x600_0.png"
396  alt="Installer &mdash; All Package View"
397 /><div class="desc">
398 Conversely,
399 when the GUI variant of <code>mingw&#8209;get</code> is invoked
400 as a free&#8209;standing application,
401 the initial three&#8209;paned view will appear as on the right;
402 (alternatively,
403 this view may be accessed by selecting the
404 <span class="nowrap"><code>All</code>&#8197;<code>Packages</code></span> option,
405 in the left&#8209;hand pane,
406 regardless of how <code>mingw&#8209;get</code> has been started).
407 <p>You may observe that,
408 in comparison with the
409 <span class="nowrap"><code>Basic</code>&#8197;<code>Setup</code></span> view,
410 this view offers a selection of many more packages,
411 from which you may choose those which you would like to install
412 ... so many more that,
413 to see the entire selection,
414 you will need to scroll the list in the upper right window pane;
415 if you find this extensive package list to be too confusing,
416 you may refine the visible selection by clicking on
417 any of the subsidiary package categories,
418 as shown in the package category tree view,
419 in the left hand pane.
420 </p>
421 <p>As with selection of packages from the
422 <span class="nowrap"><code>Basic</code>&#8197;<code>Setup</code></span> view,
423 you may elect to install any packages which are visible in the
424 <span class="nowrap"><code>All</code>&#8197;<code>Packages</code></span> view,
425 making your selection by clicking on the small square button,
426 to the left of the name of each chosen package,
427 in turn,
428 and choosing the <span class="nowrap">
429 <code>Mark</code>&#8197;<code>for</code>&#8197;<code>Installation</code></span>
430 option from the associated context menu.
431 </p>
432 </div><!-- ol.setup-steps desc -->
433 </li>
434 <div class="step-ref" id="step-2-iii"></div>
435 <li><img src="https://static-cdn.osdn.net/thumb/g/7/714/800x600_0.png"
436  alt="Installer &mdash; Apply Changes View"
437 /><div class="desc">
438 Once you have made a selection of packages to be installed,
439 from either the
440 <span class="nowrap"><code>Basic</code>&#8197;<code>Setup</code></span> view,
441 or the
442 <span class="nowrap"><code>All</code>&#8197;<code>Packages</code></span> view,
443 as described above,
444 you must commit this selection,
445 to complete your installation,
446 by proceeding as follows:&ndash;
447 <ol>
448 <li>Open the <code>Installation</code> menu,
449 (on the menu bar),
450 and select the
451 <span class="nowrap"><code>Apply</code>&#8197;<code>Changes</code></span> option;
452 (this will open a dialogue,
453 similar to that shown to the right).</li>
454 <li>Review the schedule of pending installation actions,
455 (noting that you may need to scroll the lists of packages for which deletion,
456 upgrade, or installation actions have been scheduled,
457 for any of these lists which includes more than six package entries),
458 then choose <em>one</em>&hairsp; of:&ndash;
459 <ul>
460 <li>Click the <code>Apply</code> button,
461 to complete <em>all</em> scheduled actions,
462 update indicated installation status,
463 clear the schedule of pending actions,
464 and return to the selection phase of installation,
465 to allow initiation of a further package selection.</li>
466 <li>Click the <code>Defer</code> button,
467 if you would like to modify your package selection;
468 this will take you back to the package selection phase of installation,
469 to allow you to make your desired changes.</li>
470 <li>Click the <code>Discard</code> button,
471 if you do <em>not</em>&hairsp; wish to commit <em>any</em>&hairsp;
472 of the scheduled changes;
473 this will clear your active package selection,
474 then return you to the package selection phase of installation,
475 whence you may start the installation process again.</li>
476 </ul></ol>
477 </div><!-- ol.setup-steps desc -->
478 </li>
479 <li><div class="desc">
480 After you have completed your selection of packages,
481 and you have committed all of the changes which are needed to install them,
482 you may quit from <code>mingw&#8209;get</code>,
483 either by selecting the <code>Quit</code> option
484 from the <code>Installation</code> menu,
485 or by simply closing the <span class="nowrap">
486 &#8220;MinGW&#8197;Installation&#8197;Manager&#8221;</span> GUI window.
487 Having done so,
488 and in particular,
489 if you have just completed a first&#8209;time installation,
490 you may need to perform some post&#8209;installation system configuration,
491 as described in the following section,
492 to make your installation work.
493 <p style="display: none">
494 At this point,
495 if you plan to use the MSYS command line interpreter system,
496 your MinGW installation should be ready to use;
497 however,
498 if you choose to use MinGW from Microsoft&#8217;s
499 <span class="nowrap">&#8220;command&#8197;prompt&#8221;</span>
500 console subsystem,
501 then you may need to complete the
502 <a href="#post-install">MinGW post&#8209;installation steps</a>
503 as <a href="#post-install">described below</a>.
504 </p>
505 </div><!-- ol.setup-steps desc -->
506 </li></ol>
507 </div><!-- install-packages -->
508
509 <div style="clear: both"></div>
510 <div class="overlapped" id="post-install">
511 <h3>Post&#8209;Installation Requirements for Use of the MinGW Compiler Suite</h3>
512 <p>As noted above,
513 the process of installation alone
514 is likely to be insufficient to acquire a working MinGW system:
515 some additional one&#8209;time system configuration is usually required.
516 </p>
517 <p>Although some users may choose
518 to use an integrated development environment (IDE),
519 it is important to understand that, fundamentally,
520 MinGW applications are intended for deployment
521 using a command line interface (CLI);
522 the scope of the necessary system configuration
523 is dependent on <em>your</em>&hairsp; choice of infrastructure,
524 for provision of a suitable CLI,
525 or IDE.
526 Some choices,
527 which you may wish to consider,
528 include:&ndash;
529 </p>
530 <ol class="config-options">
531 <li>Run the MinGW tools <em>directly</em>,&hairsp;
532 using Microsoft&#8217;s <code>cmd.exe</code> interpreter,
533 within the MS&#8209;Windows default <span class="nowrap">
534 &#8220;<code>Command</code>&#8197;<code>Prompt</code>&#8221;
535 </span> console host.
536 If you choose this option,
537 (which may <em>not</em>&hairsp; be the most appropriate choice),
538 you will, at least, need to ensure that the MinGW tools can be found
539 in the <code>cmd.exe</code> executable search <code>PATH</code>,
540 as configured in the process environment.
541 The default system configuration will not normally support
542 this capability, without making an appropriate <code>PATH</code> adjustment;
543 to check if any such adjustment is necessary:&ndash;
544 <ul>
545 <li>Open a <code>Command</code>&#8197;<code>Prompt</code> console,
546 and run the command:
547 <pre class="vt box-out">
548 C:\Users\me&gt; <kbd>gcc --version</kbd>
549 </pre>
550 If this results in output similar to:
551 <pre class="vt box-out">
552 C:\Users\me&gt; <kbd>gcc --version</kbd>
553 gcc (MinGW GCC Build-2) 9.2.0
554 Copyright (C) 2019 Free Software Foundation, Inc.
555 This is free software; see the source for copying conditions.  There is NO
556 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
557 </pre>
558 then it appears that your process <code>PATH</code> setting
559 <em>is already</em>&hairsp; suitably configured,
560 and <em>no further</em>&hairsp; configuration is needed;
561 however, if the output resembles:
562 <pre class="vt box-out">
563 C:\Users\me&gt; <kbd>gcc --version</kbd>
564 'gcc' is not recognized as an internal or external command,
565 operable program or batch file.
566 </pre>
567 this, then the <code>PATH</code> setting in the process environment
568 <em>is not</em>&hairsp; suitably configured;
569 you <em>should</em>&hairsp; modify the environment configuration,
570 as advised below.
571 </li></ul>
572 <p>Additionally,
573 a number of MinGW applications&nbsp;&mdash;&nbsp;any comtemporary
574 version of the GNU Debugger being a notable example&nbsp;&mdash;&nbsp;may
575 require a definition of the <code>HOME</code> environment variable.
576 Typically,
577 <code>Unix</code> systems define this,
578 to represent the path name of the current user&#8217;s
579 default working directory,
580 but MS&#8209;Windows uses the <code>USERPROFILE</code> variable
581 for this purpose,
582 so <code>HOME</code> is not normally defined.
583 </p>
584 <p>To check whether the <code>HOME</code> variable is defined,
585 or not:&ndash;
586 </p>
587 <ul><li>Run the command:
588 <pre class="vt box-out">
589 C:\Users\me&gt; <kbd>echo %HOME%</kbd>
590 </pre>
591 in a <code>Command</code>&#8197;<code>Prompt</code> console window;
592 if <code>HOME</code> has been suitably configured,
593 this should produce output similar to:
594 <pre class="vt box-out">
595 C:\Users\me&gt; <kbd>echo %HOME%</kbd>
596 C:\Users\me
597 </pre>
598 but it is more likely to produce no output at all,
599 in which case you should consider adding a <code>HOME</code> variable
600 definition to your environment variables configuration.
601 </li></ul>
602 <p>If the preceding checks indicate that
603 the <code>PATH</code> configuration needs to be adjusted,
604 or that the <code>HOME</code> variable has not been defined,
605 then you should proceed as follows:&ndash;
606 </p><ul>
607 <li>From the system <span class="nowrap">
608 <code>Control</code>&#8197;<code>Panel</code></span>,
609 open the <code>System</code> tab,
610 access the <span class="nowrap">
611 <code>Advanced</code>&#8197;<code>system</code>&#8197;<code>settings</code>
612 </span> dialogue,
613 and click the <span class="nowrap">
614 <code>Environment</code>&#8197;<code>Variables</code></span> button.
615 </li>
616 <li>In the dialogue,
617 which should now have become active,
618 observe that there are two categories of environment variables,
619 viz. a category for user&#8209;specific variables,
620 and another for system (global) variables.
621 Please note that any environment variables,
622 which you either add, or modify, in either of these categories,
623 will be recorded in the system registry,
624 and will become visible to <em>all</em>&hairsp; processes
625 which are subsequently invoked on the system,
626 (although visibility of those in the user&#8209;specific category
627 will be restricted to processes owned by the currently&#8209;logged&#8209;in
628 user), and that changes to the <code>PATH</code> variable have potential
629 to introduce system security vulnerabilities;
630 thus, you should exercise caution,
631 when making such changes, and,
632 unless it is your intention that your changes should affect
633 <em>all users</em>&hairsp; of the system,
634 you should prefer to make the change <em>only</em>&hairsp;
635 in the user&#8209;specific category,
636 in order to limit the potential of any vulnerability.
637 </li>
638 <li>Note that <code>mingw&#8209;get</code> will have installed
639 MinGW applications into <code>C:\MinGW\bin</code>,
640 (with substitution of any alternative installation&#8209;root path name,
641 which you may have chosen at installation time,
642 for the <code>C:\MinGW</code> prefix);
643 it is this equivalent for the <code>C:\MinGW\bin</code> path name,
644 (with prefix substitution as may be appropriate),
645 which you must now incorporate into the <code>PATH</code> variable,
646 to be passed in the environment,
647 to your <span class="nowrap">
648 <code>Command</code>&#8197;<code>Prompt</code></span> process.
649 </li>
650 <li>Within the environment variables category
651 in which you have decided to adjust the <code>PATH</code> setting,
652 identify the entry (matching the variable name
653 <em>case&#8209;insensitively</em>&hairsp;),
654 if it exists, for the <code>PATH</code> variable definition.
655 </li>
656 <li>If the <code>PATH</code> variable definition <em>does</em>&hairsp;
657 already exist, select it, and click the <code>Edit</code> button;
658 move the input cursor to the <em>end</em>&hairsp; of the
659 <code>Value</code> field,
660 and append a semicolon (&#8220;<code>;</code>&#8221;),
661 followed by your equivalent for <code>C:\MinGW\bin</code>,
662 with prefix substitution as required.
663 </li>
664 <li>Conversely, if no such <code>PATH</code> variable exists,
665 click the <code>New</code> button, and create a new entry for it;
666 assign your equivalent for <code>C:\MinGW\bin</code>,
667 with prefix substitution as required,
668 as its value.
669 </li>
670 <li>Similarly, to add a definition for the <code>HOME</code> variable,
671 click the <code>New</code> button, and create the requisite entry;
672 it should be given a suitable value, which typically, could be to
673 inherit the value of the <code>USERPROFILE</code> variable.
674 </li>
675 <li>Click the <code>OK</code> button on each nested dialogue box,
676 as you walk focus back to the top level of the <span class="nowrap">
677 <code>Control</code>&#8197;<code>Panel</code></span>,
678 so saving your environment variable changes,
679 then dismiss the <span class="nowrap">
680 <code>Control</code>&#8197;<code>Panel</code></span> itself.
681 </li></ul>
682 <p>After you have completed the above system configuration steps,
683 you may open a standard MS&#8209;Windows <span class="nowrap">
684 <code>Command</code>&#8197;<code>Prompt</code></span> console session,
685 and you <em>should</em>&hairsp; find that your MinGW tools will work,
686 without further ado.
687 </p></li>
688 <li>As a (possibly better) alternative to option
689 <span class="smaller">1</span>,
690 you may still choose to run the MinGW tools directly from
691 Microsoft&#8217;s <code>cmd.exe</code> command line interpreter,
692 but with this interpreter hosted within a console session which has
693 been started from a customized &#8220;shortcut&#8221;,
694 which itself addresses the issue of adding the equivalent of
695 <code>C:\MinGW\bin</code> to the <code>PATH</code>
696 environment variable setting;
697 this ensures that the modified <code>PATH</code> setting is visible
698 <em>only</em>&hairsp; to processes which are invoked from within
699 the hosting console session itself, and thus
700 <em>significantly</em>&hairsp; reduces any associated potential
701 for exposure to system security vulnerability exploits.
702 <p>To implement this <code>PATH</code> configuration technique:&ndash;
703 </p><ul>
704 <li>Create a new &#8220;shortcut&#8221;,
705 ideally within the <code>MinGW</code> subdirectory
706 (folder) of your user&#8209;specific
707 <span class="nowrap"><code>Start</code>&#8197;<code>Menu</code></span>,
708 (or, if preferred, in the <code>MinGW</code> subdirectory of the
709 <span class="nowrap"><code>All</code>&#8197;<code>Users</code></span>
710 <span class="nowrap"><code>Start</code>&#8197;<code>Menu</code></span>,
711 noting that you may need to create the respective <span class="nowrap">
712 <code>"Start</code>&#8197;<code>Menu\MinGW"</code></span> subdirectory,
713 if it does not already exist);
714 you should name this new &#8220;shortcut&#8221; as
715 <span class="nowrap"><code>"MinGW</code>&#8197;<code>Prompt.lnk"</code>,</span>
716 <span class="nowrap"><code>"MinGW</code>&#8197;<code>Console.lnk"</code>,</span>
717 or any similar alternative name of your own choice.
718 <li>Set the <code>Target</code> of your new &#8220;shortcut&#8221; to:
719 <pre class="vt box-out">
720 <kbd>%comspec% /c path %PATH%;C:\MinGW\bin&amp;set HOME=%USERPROFILE%&amp;%comspec%</kbd>
721 </pre>
722 (with substitution for <code>C:\MinGW</code>, as appropriate,
723 if you chose an alternative prefix at installation time).
724 Alternatively, create a new MS&#8209;Windows batch file,
725 (called <span class="nowrap"><code>C:\MinGW\mingw.bat</code>,</span>
726 for example), with content similar to:
727 <pre class="vt box-out">
728 <kbd>set HOME=%USERPROFILE%</kbd>
729 <kbd>path %PATH%;C:\MinGW\bin</kbd>
730 <kbd>%comspec%</kbd>
731 </pre>
732 and set the &#8220;shortcut&#8221; <code>Target</code> to:
733 <pre class="vt box-out">
734 <kbd>%comspec% /c C:\MinGW\mingw.bat</kbd>
735 </pre>
736 (This latter alternative offers greater flexibility than the former,
737 insofar as the batch file may be modified to accommodate configuration
738 options beyond the minimally required <code>PATH</code> augmentation,
739 and the recommended <code>HOME</code> variable assignment).
740 </li>
741 <li>Access the properties of the new &#8220;shortcut&#8221;,
742 and set the start&#8209;up directory path name, within the
743 <span class="nowrap"><code>Start</code>&#8197;<code>in</code></span>
744 field, to select any appropriate directory of your choice;
745 if you wish to reproduce the behaviour of the standard MS&#8209;Windows
746 <span class="nowrap"><code>Command</code>&#8197;<code>Prompt</code>,</span>
747 the appropriate assignment is:
748 <pre class="vt box-out">
749 <kbd>%HOMEDRIVE%%HOMEPATH%</kbd>
750 </pre>
751 At the same time,
752 you may wish to take the opportunity to tweak &#8220;shortcut&#8221;
753 properties on the <code>Font</code>, <code>Layout</code>,
754 and <code>Colors</code> tabs.
755 </li></ul></li>
756 <li>If you chose to install MSYS,
757 and you would like to use it as your working MinGW development environment,
758 in preference to the rather more limited capabilities of the MS&#8209;Windows
759 <span class="nowrap"><code>Command</code>&#8197;<code>Prompt</code>,</span>
760 then some associated configuration checks are recommended:&ndash;
761 <ul>
762 <li>Firstly,
763 you may need to create a &#8220;shortcut&#8221;,
764 ideally within your user&#8209;specific
765 <span class="nowrap"><code>Start</code>&#8197;<code>Menu</code>,</span>
766 or within the
767 <span class="nowrap"><code>All</code>&#8197;<code>Users</code>,</span>
768 <span class="nowrap"><code>Start</code>&#8197;<code>Menu</code>;</span>
769 the recommended name for this &#8220;shortcut&#8221; is
770 <span class="nowrap"><code>MinGW</code>&#8197;<code>Shell</code>,</span>
771 and its <code>Target</code> should be set to invoke:
772 <pre class="vt box-out">
773 <kbd>C:\MinGW\MSYS\1.0\msys.bat</kbd>
774 </pre>
775 (with the path name adjusted, as may be required,
776 to represent the actual installed location of <code>msys.bat</code>).
777 </li>
778 <li>Secondly,
779 your MSYS installation <em>must</em>&hairsp; be given an appropriate
780 hint to the base location of your MinGW tools.
781 This is established by means of a &#8220;mount&nbsp;point&#8221;
782 specification, within the <span class="nowrap">
783 <code>C:\MinGW\MSYS\1.0\etc\fstab</code></span> file,
784 (again, with the <span class="nowrap"><code>C:\MinGW\MSYS\1.0</code></span>
785 path name adjusted to match the prefix,
786 in the actual location of the <code>msys.bat</code> file);
787 if this file does not exist, you should create it,
788 but in any case, you <em>must</em>&hairsp; ensure that it
789 includes (at least) a line of the form:
790 <pre class="vt box-out">
791 <kbd>C:/MinGW   /mingw</kbd>
792 </pre>
793 (again noting that the <code>C:/MinGW</code> prefix should be adjusted
794 to match any alternative, which you may have chosen at installation time,
795 and furthermore, &#8220;<code>/</code>&#8221; characters should be used
796 as directory name separators, in preference to &#8220;<code>\</code>&#8221;
797 characters, within the <code>etc/fstab</code> file).
798 </li></ul>
799 <p>You may be wondering why these post&#8209;installation instructions,
800 for MSYS, do not refer to <code>PATH</code> configuration.
801 In practice, no specific configuration is necessary, because,
802 provided the <code>/mingw</code> &#8220;mount&#8209;point&#8221;
803 is correctly specified in the <code>fstab</code> file,
804 MSYS will correctly deduce the required <code>PATH</code> setting,
805 when any shell session is started.
806 However, it <em>is</em>&hairsp; important to note that it is
807 <em>imperative</em>&hairsp; that <em>no white&#8209;space</em>&hairsp;
808 is present, within the absolute path name specification for the
809 &#8220;mount&#8209;point&#8221;;
810 thus, since this <em>must</em>&hairsp; be specified as
811 an <em>absolute</em>&hairsp; path name, if,
812 contrary to offered advice,
813 you have chosen an installation directory with white&#8209;space
814 in its absolute path name,
815 you will need to determine the short (8.3) form of your
816 installation path name,
817 and use that in the &#8220;mount&#8209;point&#8221; specification.
818 </p></li>
819 <li>Regardless of whether you choose to run the MinGW tools
820 within an MSYS session, or within a <code>cmd.exe</code> session, by default,
821 either of these will run within an MS&#8209;Windows console host
822 container.
823 If you prefer, you may choose an alternative container, such as
824 <a target="_blank" rel="noopener noreferrer" href="https://conemu.github.io">
825 ConEmu</a>,
826 <a target="_blank" rel="noopener noreferrer" href="https://github.com/bozho/console">
827 Console2</a>, or
828 <a target="_blank" rel="noopener noreferrer" href="https://github.com/cbucher/console">
829 ConsoleZ</a>.
830 While it should be feasible to use any of these,
831 each will have its own configuration considerations,
832 which are beyond the scope of this HOWTO document.
833 </li>
834 <li>Alternatively,
835 you may decide that you would prefer to deploy MinGW within an IDE.
836 Please be aware that MinGW.OSDN offers no formal support for any such
837 deployment; however, users have reported success with
838 <a target="_blank" rel="noopener noreferrer" href="https://www.codeblocks.org">
839 Code::Blocks</a>, and with
840 <a target="_blank" rel="noopener noreferrer" href="https://www.eclipse.org">
841 Eclipse</a>,
842 (but be advised that these third&#8209;party websites may
843 may exhibit out&#8209;of&#8209;date references to MinGW download sites;
844 the most up&#8209;to&#8209;date downloads of MinGW are <em>always</em>&hairsp;
845 available from <a target="_blank" rel="noopener noreferrer"
846 href="https://osdn.net/projects/mingw/">OSDN.net</a>).
847 As with option <span class="smaller">4</span>,
848 each of these IDEs will be subject to its own configuration considerations,
849 which, once again, are beyond the scope of this HOWTO document.
850 </li></ol>
851 </div><!-- post-install -->
852
853 <div style="clear: both"></div>
854 <div class="overlapped" id="maintenance">
855 <h3>Maintaining Currency of your MinGW Installation</h3>
856 <p>After you have installed your initial choice of MinGW,
857 and/or MSYS packages,
858 you will eventually discover that you need to perform some degree
859 of maintenance of your installation;
860 this need may be prompted by:&ndash;
861 </p><ul>
862 <li>A desire to install additional packages,
863 which you had not chosen to include within your original installation.
864 </li>
865 <li>Availability of newer releases of those packages,
866 which you have previously installed;
867 you will wish to upgrade your existing installation,
868 to take advantage of any such newer package releases.
869 </li>
870 </ul>
871 <p>Regardless of your motivation
872 for performing maintenance on your MinGW installation,
873 it is recommended that you use <code>mingw&#8209;get</code>,
874 either in its GUI, or in its CLI mode of operation,
875 to achieve your objective.
876 </p>
877 <p>Whether your intention is to install a new package,
878 or simply to upgrade an installed package to a newer release,
879 you should ensure that the package information records, within
880 your locally installed copy of <code>mingw&#8209;get</code>,
881 are kept up&#8209;to&#8209;date with respect to the state of
882 the online package repositories.
883 To achieve this,
884 you are advised to periodically,
885 (say, if it has been more than a week since your update),
886 request an update of your local copy of the package catalogue,
887 <em>before</em>&hairsp; you embark on any package installation,
888 or package upgrade activity.
889 You may accomplish this, either:&ndash;
890 </p><ul>
891 <li>From the <code>mingw&#8209;get</code> GUI,
892 by selecting the <span class="nowrap">
893 <code>Update</code>&#8197;<code>Catalogue</code></span> option
894 from the <code>Installation</code> menu.
895 <li>From the MinGW CLI, simply by running the command:
896 <pre class="vt box-out">
897 C:\Users\me&gt; <kbd>mingw-get update</kbd>
898 </pre>
899 </li></ul>
900 <p>After updating your package catalogue,
901 to synchronize with the online package repository state,
902 you may install further packages:&ndash;
903 </p><ul>
904 <li>From the <code>mingw&#8209;get</code> GUI,
905 by following the procedure described in <a href="#install-packages">
906 section <span class="smaller">2</span>, above</a>.
907 </li>
908 <li>From the MinGW CLI, by running the command:
909 <pre class="vt box-out">
910 C:\Users\me&gt; <kbd>mingw-get install</kbd> &lt;<em>package-name</em>&gt;
911 </pre>
912 </li></ul>
913 <p>When a new version of any package,
914 which you have already installed, is released,
915 you will want to upgrade your installation,
916 to incorporate the package changes.
917 Once again, you can perform the upgrade from either
918 the <code>mingw&#8209;get</code> GUI,
919 or the MinGW CLI;
920 the simplest procedure,
921 which will upgrade <em>all</em>&hairsp; installed packages,
922 for which new releases are available,
923 <em>en masse</em>,&hairsp; is&ndash;
924 </p><ul>
925 <li>From the <code>Installation</code> menu of
926 the <code>mingw&#8209;get</code> GUI,
927 select the <span class="nowrap">
928 <code>Mark</code>&#8197;<code>All</code>&#8197;<code>Upgrades</code>
929 </span> option, followed by the <span class="nowrap">
930 <code>Apply</code>&#8197;<code>Changes</code>,</span>
931 then review, and commit the changes,
932 following the procedure described in
933 <a href="#step-2-iii">section <span class="smaller">2</span>, step iii</a>,
934 above.
935 </li>
936 <li>From the MinGW CLI, execute the command:
937 <pre class="vt box-out">
938 C:\Users\me&gt; <kbd>mingw-get upgrade</kbd>
939 </pre>
940 (without <em>any</em>&hairsp; <span class="nowrap">
941 <code>&lt;<em>package-name</em>&gt;</code></span> argument);
942 this CLI method performs <em>identically</em>&hairsp; the same
943 <em>en masse</em>&#8209; upgrade as the GUI method, <em>except</em>&hairsp;
944 that it offers <em>no opportunity</em>&hairsp; for review of the scheduled
945 changes, prior to <em>unconditionally</em>&hairsp; committing them.
946 </li></ul>
947 <p>Alternatively,
948 you may choose to perform a <em>selective</em>&hairsp; upgrade
949 of individual packages:&ndash;
950 </p><ul>
951 <li>In the <code>mingw&#8209;get</code> GUI,
952 by selecting the <span class="nowrap">
953 <code>Mark</code>&#8197;<code>for</code>&#8197;<code>Upgrade</code>
954 </span> option, in the context menu which is attached to the status icon
955 to the left of the package list entry for each package of interest;
956 (those packages, for which upgrades are available, are identified
957 by a yellow star, in the upper right corner of the status icon).
958 <p>After selecting packages to upgrade,
959 once again select the <span class="nowrap">
960 <code>Apply</code>&#8197;<code>Changes</code></span> option
961 from the <code>Installation</code> menu,
962 and proceed as in <a href="#step-2-iii">
963 section <span class="smaller">2</span>, step iii</a>.
964 </p></li>
965 <li>From the MinGW CLI, execute the command:
966 <pre class="vt box-out">
967 C:\Users\me&gt; <kbd>mingw-get upgrade</kbd> &lt;<em>package-name</em>&gt;
968 </pre>
969 for each package which you wish to upgrade,
970 (which will also, implicitly, identify each additional upgradeable package
971 upon which each specified package is dependent).
972 </li></ul>
973 </div><!-- maintenance -->
974 </div><!-- h3-numbered -->
975
976 <!-- $RCSfile$: end of file -->