OXYGENHUB
◆ main openmsx / doc / manual / compile.html
33.8 KiB · HTML · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
  <meta charset="utf-8">
5
  <link title="Purple" rel="stylesheet" href="manual-purple.css" type="text/css">
6
  <link title="Minty" rel="alternate stylesheet" href="manual-minty.css" type="text/css">
7
  <link title="Plain" rel="alternate stylesheet" href="manual.css" type="text/css">
8
  <title>openMSX Compilation Guide</title>
9
</head>
10
11
<body>
12
13
<h1>openMSX Compilation Guide</h1>
14
15
<h2>Contents</h2>
16
<ol class="toc">
17
	<li><a class="internal" href="#intro">1. Introduction</a>
18
		<ol class="toc">
19
			<li><a class="internal" href="#newver">1.1 New Versions of this Document</a></li>
20
			<li><a class="internal" href="#purpose">1.2 Purpose</a></li>
21
			<li><a class="internal" href="#history">1.3 Revision History</a></li>
22
		</ol>
23
	</li>
24
	<li><a class="internal" href="#preparation">2. Preparation</a>
25
		<ol class="toc">
26
			<li><a class="internal" href="#tools">2.1 Build Tools</a></li>
27
			<li><a class="internal" href="#libs">2.2 Libraries</a></li>
28
		</ol>
29
	</li>
30
	<li><a class="internal" href="#getsource">3. Getting the Source Code</a>
31
		<ol class="toc">
32
			<li><a class="internal" href="#getrelease">3.1 Released Version</a></li>
33
			<li><a class="internal" href="#getscm">3.2 Git Clone</a></li>
34
		</ol>
35
	</li>
36
	<li><a class="internal" href="#local">4. Binary for Local System</a>
37
		<ol class="toc">
38
			<li><a class="internal" href="#compilelocal">4.1 Compilation</a></li>
39
			<li><a class="internal" href="#installlocal">4.2 Installation</a></li>
40
		</ol>
41
	</li>
42
	<li><a class="internal" href="#standalone">5. Stand-alone Binary</a>
43
		<ol class="toc">
44
			<li><a class="internal" href="#compilestandalone">5.1 Compilation</a></li>
45
			<li><a class="internal" href="#installstandalone">5.2 Installation</a></li>
46
		</ol>
47
	</li>
48
	<li><a class="internal" href="#next">7. Next Steps</a></li>
49
<li><a class="internal" href="#contact">8. Contact Info</a></li>
50
</ol>
51
52
<h2><a id="intro">1. Introduction</a></h2>
53
54
<h3><a id="newver">1.1 New Versions of this Document</a></h3>
55
<p>
56
The latest version of the openMSX manual can be found on the openMSX home page:
57
</p>
58
<p>
59
<a class="external" href="http://openmsx.org/manual/">http://openmsx.org/manual/</a>
60
</p>
61
<p>
62
You can also use this URL to get up-to-date versions of the hyperlinks
63
if you printed out this manual.
64
</p>
65
66
<h3><a id="purpose">1.2 Purpose</a></h3>
67
<p>
68
This guide is about openMSX, the open source MSX emulator that tries to achieve
69
near-perfect emulation by using a novel emulation model.
70
You can find more information about openMSX on the
71
<a class="external" href="http://openmsx.org/">openMSX home page</a>.
72
</p>
73
74
<p>
75
If you just want to use openMSX, there is likely <a class="external" href="faq.html#easyinstall">a pre-packaged version</a> you can use. This document describes how you can compile openMSX from source, which is useful if:
76
</p>
77
<ul>
78
<li>There is not yet a pre-packaged version for your favourite platform.</li>
79
<li>You want to closely follow the latest developments.</li>
80
<li>You want to make changes to openMSX.</li>
81
</ul>
82
83
<p>
84
If you only want to follow the latest developments, chances are an
85
automatic build has been performed for your platform. Links to such
86
development builds can be found on the <a class="external"
87
href="http://openmsx.org/">openMSX website</a>, at the bottom of the Download
88
box.
89
</p>
90
91
<p>
92
If you need help compiling openMSX, please
93
<a class="internal" href="#contact">contact us</a>.
94
If you needed any modifications to make openMSX compile,
95
please send those modifications to us,
96
so we can make openMSX ever more portable.
97
</p>
98
99
<h3><a id="history">1.3 Revision History</a></h3>
100
101
<p>
102
For the revision history, please refer to the <a class="external"
103
href="https://github.com/openMSX/openMSX/commits/master/doc/manual/compile.html">commit log</a>.
104
</p>
105
106
<h2><a id="preparation">2. Preparation</a></h2>
107
108
<p>
109
Before you can start compiling openMSX, please make sure your system
110
has all the necessary build tools installed, as well as the libraries
111
openMSX depends upon. The following sections tell you how you can prepare your system.
112
</p>
113
<p>
114
Every section starts with generic instructions that apply to all platforms and
115
compilers. At the end of each section, platform specific notes cover differences or additional steps for certain platforms
116
or compilers.
117
</p>
118
119
<h3><a id="tools">2.1 Build Tools</a></h3>
120
121
<p>
122
For compilation, you need <a class="external" href="http://www.python.org/download/">Python</a>, a C++ compiler, and some compiler-specific programs.
123
If you have compiled packages from source before, you probably have some of these installed already.
124
</p>
125
126
<dl>
127
128
<dt><a class="external" href="http://www.python.org/download/">Python</a></dt>
129
<dd>A compact and dynamic programming language. The latest version should work fine. Note: on Windows you may have to add the path to Python (e.g. <code>C:\Python</code>) to your <code>PATH</code> manually.</dd>
130
<dt>C++ compiler</dt>
131
<dd>There are three compilers that are supported to build openMSX: GCC, clang
132
and Visual C++. The GCC compiler builds openMSX on all supported platforms, clang (Xcode) is the default on macOS, while Visual C++ is the primary compiler for Windows.</dd>
133
134
</dl>
135
136
<h4>GCC</h4>
137
138
<p>For compilation with GCC, you need GNU Make and g++:</p>
139
140
<dl>
141
142
<dt>make</dt>
143
<dd>GNU implementation of the Make tool.
144
Make interprets rules that define how a project should be built.
145
Version 3.80 or higher is required.</dd>
146
147
<dt>g++</dt>
148
<dd>The GNU C++ compiler.
149
At least version 13 is required to build openMSX.
150
</dd>
151
152
</dl>
153
154
<h4>clang</h4>
155
156
<h5>macOS</h5>
157
158
<p>
159
Install Xcode from Apple, which you can find in the Mac App Store. The openMSX build is not done inside the Xcode IDE, but it uses the SDK and command line tools that are provided by Xcode. Xcode 16.4 or higher is required.
160
</p>
161
162
<h4>Visual C++</h4>
163
164
<p>To build with Visual C++ you need to have the latest version of it installed. Currently, this is Visual C++ 2022.</p>
165
166
<p>How to obtain the Visual C++ compiler:</p>
167
<dl>
168
	<dt><a class="external" href="http://www.visualstudio.com/downloads/">Visual Studio Community</a></dt>
169
	<dd>This is a free (as in beer) IDE and development environment. It builds 32 and 64-bit binaries out of the box. Make sure you download the latest version. </dd>
170
171
</dl>
172
173
<p>To generate an MSI installation package, you also need:</p>
174
175
<dl>
176
177
<dt> <a class="external" href="http://wixtoolset.org/">WiX</a></dt>
178
<dd>This is a tool that generates MSI installer packages. We recommend using
179
version 3.0 or later. If you see a message that the &quot;Votive&quot;
180
component won't install, that's not a problem, just continue.</dd>
181
182
</dl>
183
184
<h3><a id="libs">2.2 Libraries</a></h3>
185
186
<p>
187
openMSX depends on the following libraries:
188
</p>
189
<dl>
190
191
<dt><a class="external" href="http://www.libsdl.org/">SDL</a></dt>
192
<dd>Simple DirectMedia Layer version 2, a cross-platform library that provides low-level access to video, audio and input devices.</dd>
193
194
<dt><a class="external" href="http://www.libsdl.org/projects/SDL_ttf/">SDL_ttf</a></dt>
195
<dd>Library that provides support for TrueType Fonts in SDL.</dd>
196
197
<dt><a class="external" href="http://www.libpng.org/pub/png/libpng.html">libpng</a></dt>
198
<dd>Library for handling PNG images.</dd>
199
200
<dt><a class="external" href="http://www.zlib.org/">zlib</a></dt>
201
<dd>Library for file compression.</dd>
202
203
<dt><a class="external" href="http://www.tcl.tk/">Tcl</a></dt>
204
<dd>The Tool Command Language, an embeddable scripting language. openMSX requires Tcl 8.6; older versions will not work.</dd>
205
206
<dt><a class="external" href="http://www.opengl.org/">OpenGL</a></dt>
207
<dd>Library for accelerated graphics. It is likely that OpenGL is already installed on your system. If not, you should probably get the OpenGL implementation from the manufacturer of your graphics card. On Linux, using <a class="external" href="http://www.mesa3d.org/">Mesa</a> with a DRI driver can be an alternative.</dd>
208
209
<dt><a class="external" href="http://glew.sourceforge.net/">GLEW</a></dt>
210
<dd>The OpenGL Extension Wrangler, a library that greatly simplifies the use of OpenGL extensions.</dd>
211
212
<dt><a class="external" href="http://www.xiph.org/ogg/">Ogg</a> (optional)</dt>
213
<dd>The Laserdisc emulation expects files in the Ogg container format for the video and audio of Laserdiscs.</dd>
214
215
<dt><a class="external" href="http://www.xiph.org/vorbis/">Vorbis</a> (optional)</dt>
216
<dd>The Laserdisc emulation expects audio encoded with Vorbis in the Ogg container format for the audio of Laserdiscs. Vorbis was chosen since it is not patent-encumbered.</dd>
217
218
<dt><a class="external" href="http://www.xiph.org/theora/">Theora</a> (optional)</dt>
219
<dd>The Laserdisc emulation expects video encoded with the Theora codec in the Ogg container format for the video of Laserdiscs. Again, Theora was chosen since it is not patent-encumbered.</dd>
220
221
<dt><a class="external" href="http://www.alsa-project.org/">ALSA</a> (optional, Linux only)</dt>
222
<dd>The ALSA library for ALSA MIDI out support on Linux.</dd>
223
224
</dl>
225
226
<h4>GCC / clang</h4>
227
<p>
228
You can install the required libraries system-wide, or you can use the "3rd party libraries" support in the openMSX build system and build a stand-alone binary. System-wide is recommended if you run a modular operating system (such as Linux, BSD or macOS with MacPorts, Homebrew or Fink) and you intend to only use the openMSX binary on your computer. The 3rd party library system is recommended if you build for other operating systems (Windows, plain macOS or embedded systems) or if you want to build a binary that can be used on other computers besides your own. If you choose the latter, please skip to the <a class="internal" href="#standalone">Stand-alone Binary</a> chapter.
229
</p>
230
<h5>Debian and Ubuntu Linux</h5>
231
<p>
232
You can easily install all required packages using the "build dependencies" feature of the APT package manager (if you have source packages in your package sources list):
233
</p>
234
<div class="commandline">
235
sudo apt-get build-dep openmsx
236
</div>
237
<p>
238
Do note that if the Debian/Ubuntu package that is in the version of the distribution you are currently running is older than the openMSX version you are trying to compile (which is typically so), you might miss some dependencies that were added in the newer version. The build system will complain and you will have to install the remaining (missing) packages manually. Read on to get some tips about that.
239
</p>
240
<p>
241
Typical depending packages are: <code>libsdl2-ttf-dev</code> <code>libogg-dev</code>  <code>tcl-dev</code>  <code>libpng-dev</code>  <code>libtheora-dev</code>  <code>libvorbis-dev</code>  <code>libsdl2-dev</code>  <code>libglew-dev</code>. The complete list for Debian (which will be very very similar) is <a class="external" href="https://packages.debian.org/source/sid/openmsx">here</a>.
242
</p>
243
244
<h5>Other Linux</h5>
245
<p>
246
Most Linux distributions have their libraries split over two packages: a runtime package and a development package.
247
The runtime package for the "Foo" library is typically called
248
<code>libfoo</code>, the development package is typically named
249
<code>libfoo-dev</code> or <code>libfoo-devel</code>.
250
Applications that use a library only require the runtime package to be installed, but compilation requires both the runtime package and the development package to be installed.
251
</p>
252
253
<h5>macOS</h5>
254
255
<p>
256
The easiest thing to do is to use the <a class="internal" href="#standalone">stand-alone binary</a> method, which will get the libraries automatically.</p>
257
<p>
258
If you want to do things manually, you can get the libraries from
259
<a class="external" href="http://www.macports.org/">MacPorts</a>,
260
<a class="external" href="http://brew.sh/">Homebrew</a>
261
or
262
<a class="external" href="http://www.finkproject.org/">Fink</a>. These tools provide access to a large collection of software packages or ports. You can use them to install those packages (or ports). The manual approach is not regularly tested by the openMSX developers; unless you enjoy tinkering with builds we suggest you use the stand-alone binary approach instead.
263
</p>
264
265
<h4>Visual C++</h4>
266
267
<p>
268
When building with Visual C++, the optional libraries mentioned above are
269
treated as follows:</p>
270
<ul>
271
	<li>Headers and libraries for OpenGL are included with Visual C++ by default.</li>
272
	<li>The GLEW, Ogg, Theora and Vorbis libraries are not optional, but required.</li>
273
</ul>
274
<p>
275
Also, when building with Visual C++, the &quot;3rd party libraries&quot; support in the openMSX
276
build system must be used. The resulting binary statically links in all
277
dependencies, including the C runtime. For more details, please see the <a class="internal" href="#standalone">
278
Stand-alone Binary</a> chapter.
279
</p>
280
<h2><a id="getsource">3. Getting the Source Code</a></h2>
281
282
<p>
283
openMSX is developed using the tools
284
<a class="external" href="http://github.com/">GitHub</a>
285
freely offers to open source projects.
286
The code is stored in Git, an open source version management system.
287
Every once in a while, a new version of openMSX is released.
288
</p>
289
290
<p>
291
There are several options for getting the source code:
292
</p>
293
294
<dl>
295
296
<dt><a class="internal" href="#getrelease">Released Version</a></dt>
297
<dd>
298
These are tested versions, which should little or no trouble getting them compiled and running.
299
However, as openMSX development if often quite fast, these tested versions may not have all
300
the latest features.
301
Bugs that have been fixed since the last release could also still be present.
302
</dd>
303
304
<dt><a class="internal" href="#getscm">Git Clone</a></dt>
305
<dd>
306
Through Git you can get the same development version the
307
openMSX developers are using.
308
This is the bleeding edge version, which contains all the latest stuff and may be absolutely fantastic or horribly broken.
309
Usually the latest openMSX code compiles and runs fine, but we're only human,
310
so once in a while it may break.
311
This version may also contain changes that have not been documented yet.
312
</dd>
313
314
</dl>
315
316
<p>
317
Releases are intended for general users, Git Clone is intended for
318
(would-be) developers, heavy testers and people who want to follow up new
319
developments closely. It might be a good idea to play with a tested release first. If
320
you like what you see and want to get in deeper, you can switch to a Git Clone later.
321
Using a Git Clone is quite comfortable, as it allows you to do efficient
322
incremental updates, saving network bandwidth and compile time.
323
</p>
324
325
<p>
326
If the version you downloaded is either a lot older or a lot newer than
327
this guide, it is a good idea to read the guide included in your downloaded
328
version instead of the version you're reading right now.
329
You can find the Compilation Guide in the directory
330
<code>doc/manual</code>.
331
</p>
332
333
<h3><a id="getrelease">3.1 Released Version</a></h3>
334
335
<p>
336
You can download a released version of openMSX from
337
<a class="external" href="https://github.com/openMSX/openMSX/releases/"
338
>the releases page on GitHub</a>.
339
The latest version is probably the best one. This guide assumes that you are using the latest release.
340
</p>
341
342
<p>
343
After downloading, type the following in a UNIX or MinGW Shell (in your start menu), or use another
344
decompression tool:
345
</p>
346
<div class="commandline">tar xzvf openmsx-VERSION.tar.gz</div>
347
<p>
348
in which <code>VERSION</code> is the openMSX version you downloaded, or use the
349
file name you saved the tar.gz file with. The directory that is created by uncompressing the <code>tar.gz</code> file
350
is called <em>the top of the source tree</em>.
351
</p>
352
353
<h3><a id="getscm">3.2 Git Clone</a></h3>
354
355
<p>
356
Getting a Git clone means you use Git to retrieve the latest version
357
of the source code of openMSX.
358
This means you will need to install a Git client.
359
This package is usually named <code>git</code>.
360
There are graphical front-ends for Git,
361
but this guide will tell you how to use Git from the command line. More information about Git can be found on the <a class="external"
362
href="http://git-scm.com/documentation">Git Documentation</a> site.</p>
363
<p>
364
Windows
365
users might want to have a look at <a class="external" href="https://git-for-windows.github.io/">msysGit</a> as a command line tool, <a class="external" href="http://code.google.com/p/tortoisegit/">TortoiseGit</a>, which offers Windows Explorer integration, or <a class="external" href="http://gitextensions.github.io/">Git Extensions</a>, a tool which also includes Visual Studio integration.
366
</p>
367
368
<p>
369
The following command (which is also displayed when you <a class="external" href="https://github.com/openMSX">browse an openMSX Git repository</a>) retrieves the latest source code (also works on Windows when using msysGit):
370
</p>
371
<div class="commandline">
372
git clone https://github.com/openMSX/openMSX.git openMSX
373
</div>
374
<p>
375
This line specifies where you want to retrieve the files from
376
(host name of the Git server),
377
what project you want to retrieve (<em>openMSX</em> in this case), what
378
module you want to get (<em>openMSX.git</em> in this case, which is the module that contains
379
the sources of the main openMSX program) and what directory it should be
380
cloned to (we chose <em>openMSX</em> in this example).
381
</p>
382
383
<p>
384
If you're a developer, it makes sense to use this Git command line:
385
</p>
386
<div class="commandline">
387
git clone [email protected]:openMSX/openMSX.git openMSX
388
</div>
389
390
<p>
391
Pro tip: <a class="external" href="https://help.github.com/articles/generating-ssh-keys/#platform-all">read the GitHub docs about SSH keys</a> if you want this to work smoothly, without having to (re)type your password all the time.
392
</p>
393
394
<p>
395
The Git command creates a directory called <code>openMSX</code> for you
396
in the current directory (or in the directory you specified in TortoiseGit).
397
In this manual, this directory is referred to as <em>the top
398
of the source tree</em>.
399
In addition to the openMSX code, you will see a hidden
400
Git administration directory called <code>.git</code>.
401
Do not mess with it (nor move contents of this directory around), otherwise Git will get very confused.
402
</p>
403
404
<p>
405
If you want to update your source tree later,
406
go to the top of the source tree and type:
407
</p>
408
<div class="commandline">
409
git pull
410
</div>
411
<p>
412
or right-click on the openMSX directory in Windows Explorer and select "TortoiseGit -&gt; Pull...".
413
</p>
414
415
<h2><a id="local">4. Binary for Local System</a></h2>
416
417
<p>
418
This section explains how to build openMSX for a local system. If you want to create a binary that runs everywhere, we recommend to skip this chapter and use the <a class="internal" href="#standalone">stand-alone binary</a> method. This is also the recommended approach for macOS and especially for Microsoft Windows systems.
419
</p>
420
421
<h3><a id="compilelocal">4.1 Compilation</a></h3>
422
423
<p>
424
Now that all the necessary tools and libraries are installed,
425
you are almost ready to start the actual compilation of openMSX.
426
</p>
427
428
<h4>GCC / clang</h4>
429
430
<p>
431
The first thing you may want to know is that you can build openMSX in
432
different flavours. The generic optimized flavour "opt" should work for all CPUs.
433
</p>
434
<p>
435
If you are testing new openMSX developments or making changes in openMSX, you can benefit from asserts and debug symbols. To get those, you should select the "devel" flavour, like this:
436
</p>
437
<div class="commandline">
438
export OPENMSX_FLAVOUR=devel
439
</div>
440
<p>
441
Although the default flavours will probably be OK for most cases, you may want to write a specific flavour for your particular wishes. The flavour files are all named <code>build/flavour-*.mk</code>.
442
</p>
443
444
<p>
445
You can select the C++ compiler to be used by setting the <code>CXX</code> environment variable like this:
446
</p>
447
<div class="commandline">
448
export CXX=g++-5
449
</div>
450
<p>
451
or:
452
</p>
453
<div class="commandline">
454
export CXX=clang++
455
</div>
456
<p>
457
This can be useful if the default compiler on your system is an old version which is either not capable of compiling openMSX, or generates less efficient code.
458
</p>
459
460
<p>
461
Now we can let a script check if you have indeed all necessary libraries and headers installed.
462
Go to the top of your openMSX source tree and run the following script:
463
</p>
464
<div class="commandline">
465
./configure
466
</div>
467
<p>
468
This script will report what versions of libraries you have installed.
469
It also reports which components can be built with those libraries.
470
If the script reports that it can't build the openMSX core component,
471
you should install the missing ones before you can continue.
472
Otherwise, you can decide to install the libraries needed for the optional
473
components, or to continue without building some components (e.g. the Laserdisc support).
474
</p>
475
476
<p>
477
If installing the correct libraries doesn't help,
478
<a class="internal" href="#contact">contact the openMSX developers</a>.
479
When filing a bug report, please attach the <code>probe.log</code> file
480
created by the <code>configure</code> script in the directory
481
<code>derived/&lt;cpu&gt;-&lt;os&gt;-&lt;flavour&gt;/config/</code>.
482
</p>
483
484
<p>
485
You can customise the build process by editing the file
486
<code>build/custom.mk</code>.
487
The thing you most likely might want to customise is the installation directory (<code>INSTALL_BASE</code>).
488
If you are installing openMSX on a system on which you do not have
489
superuser (root) privileges, you can set the installation directory
490
to a subdirectory of your home directory.
491
</p>
492
493
<p>
494
After successfully running <code>configure</code>,
495
it's finally time to compile everything.
496
To start compilation, type:
497
</p>
498
<div class="commandline">
499
make
500
</div>
501
<p>
502
Depending on how fast your system is,
503
this may take anywhere between several minutes to half an hour.
504
</p>
505
506
<p>
507
If you get errors during compilation,
508
there may be something wrong that was not detected by configure.
509
Verify that you installed
510
<a class="internal" href="#libs">all required libraries</a>,
511
both the runtime and development packages.
512
If that doesn't help, or we forgot to list a library openMSX depends on, please
513
<a class="internal" href="#contact">contact the openMSX developers</a>.
514
Make sure to include the error message you got.
515
</p>
516
517
<p>
518
If you want to debug openMSX compilation problems yourself, you can add <code>V=1</code> (verbose) to the Make command line to see all build commands as they are executed.
519
</p>
520
521
<h5>macOS</h5>
522
523
<p>
524
The version of Xcode required also determines which version of macOS you need to build openMSX out of the box.
525
</p>
526
527
<h4>Visual C++</h4>
528
529
<p>
530
While it is possible to configure the supplied Visual C++ project files to
531
dynamically link against import libraries, this is not currently supported.</p>
532
<h3><a id="installlocal">4.2 Installation</a></h3>
533
534
<h4>GCC / clang</h4>
535
536
<h5>Linux and BSD</h5>
537
538
<p>
539
To install openMSX, run the following command:
540
</p>
541
<div class="commandline">
542
make install
543
</div>
544
<p>
545
This installs openMSX in <code>/opt/openMSX</code> by default.
546
Note that only root has rights to write to system-wide directories such as
547
<code>/opt</code>,
548
so you may have to do <code>su</code> before <code>make install</code>, or use <code>sudo</code>:
549
</p>
550
551
<div class="commandline">
552
sudo make install
553
</div>
554
555
<h5>macOS</h5>
556
557
<p>
558
On macOS, the build creates an application folder. You can "install" this simply by copying this folder to a different location. The application folder will depend on system-wide installed libraries, so it will not work on Macs lacking those libraries.
559
</p>
560
<p>
561
You can run openMSX from the application folder with the following command:
562
</p>
563
<div class="commandline">
564
open derived/&lt;cpu&gt;-darwin-&lt;flavour&gt;/bindist/openMSX.app
565
</div>
566
<p>
567
If you want to see the messages openMSX prints to stdout and stderr, start openMSX like this:
568
</p>
569
<div class="commandline">
570
derived/&lt;cpu&gt;-darwin-&lt;flavour&gt;/bindist/openMSX.app/Contents/MacOS/openmsx
571
</div>
572
573
<h2><a id="standalone">5. Stand-alone Binary</a></h2>
574
575
<p>
576
This chapter describes how to build a binary of openMSX that does not depend on any libraries except those that are available on the platform by default. This procedure is highly recommended on Microsoft Windows. It is also recommended on macOS.
577
</p>
578
579
<p>
580
The stand-alone binary is made by linking statically against all libraries which are not available as part of the basic platform. The build system will automatically download the sources for these libraries and build them in the minimal configuration needed by openMSX.</p>
581
582
<h3><a id="compilestandalone">5.1 Compilation</a></h3>
583
584
<h4>GCC / clang</h4>
585
<p>
586
If you want to change something about this process, for example switch to a newer library release, edit the <code>build/3rdparty.mk</code> Makefile.
587
</p>
588
589
<p>
590
Similar to standard compilation, you can set environment variables such as <code>OPENMSX_FLAVOUR</code>, <code>CXX</code>, <code>OPENMSX_TARGET_CPU</code> and <code>OPENMSX_TARGET_OS</code>.
591
</p>
592
593
<p>
594
To build a stand-alone binary, run the following command at the top of the source tree:
595
</p>
596
<div class="commandline">
597
make staticbindist
598
</div>
599
<p>
600
The final output files will be produced in <code>derived/&lt;cpu&gt;-&lt;os&gt;-&lt;flavour&gt;-3rd/bindist</code>.
601
</p>
602
603
<h5>macOS</h5>
604
605
<p>
606
The final output is a DMG file (Mac disk image) containing the openMSX application folder and documentation. This file is internet-enabled, which means it will be automatically mounted after it is downloaded.
607
</p>
608
<p>
609
If you have an Apple Developers ID, you can automatically sign the app bundle by providing the following environment variable in your shell before building the app bundle:
610
</p>
611
<div class="commandline">
612
    <pre>
613
export CODE_SIGN_IDENTITY=&lt;your Apple Application Developer ID here&gt;
614
make staticbindist
615
    </pre>
616
</div>
617
<p>
618
To find the exact string needed for the CODE_SIGN_IDENTITY, use the command:
619
</p>
620
<div class="commandline">
621
security find-identity
622
</div>
623
<p>
624
Check if the code signing was successful with:
625
</p>
626
<div class="commandline">
627
codesign -dv --verbose=4 derived/&lt;cpu&gt;-&lt;os&gt;-&lt;flavour&gt;-3rd/bindist/openMSX.app
628
</div>
629
630
<h4>Visual C++</h4>
631
632
<p>When building with Visual C++, the result is a static executable with minimal
633
dynamic library dependencies. Two platforms are supported:</p>
634
<ul>
635
	<li><strong>Win32</strong> - a 32-bit binary that runs on both 32 and 64-bit versions of Windows</li>
636
	<li><strong>x64</strong> - a native 64-bit binary that runs only on 64-bit versions of Windows</li>
637
</ul>
638
<p>Three different configurations are supported:</p>
639
<ul>
640
	<li><strong>Debug</strong>: assertions enabled, debug prints enabled, no optimization,
641
	very slow</li>
642
	<li><strong>Developer</strong>: assertions enabled, debug prints disabled, no optimization</li>
643
	<li><strong>Release</strong>: assertions disabled, debug prints disabled, full optimization</li>
644
</ul>
645
<p>When building with Visual C++, you can either use the IDE or build from the command line using <code>msbuild</code>. To do the latter, you need to open a Visual Studio command prompt. A shortcut to a Visual Studio command prompt can usually be found in your start menu. For Visual Studio Community 2017, it will be in &quot;Microsoft Visual Studio 2017\Visual Studio Tools&quot; as the &quot;Visual Studio Command Prompt&quot;.</p>
646
<!-- TODO - Replace this section when we have integration with the broader 3rd party system -->
647
<p>In order to build openMSX, the libraries it depends on need to be
648
downloaded and unpacked:</p>
649
<ul>
650
	<li>Open a command prompt and go to the <em>top of the openMSX source tree</em></li>
651
	<li>Type <code>python build\thirdparty_download.py windows</code></li>
652
</ul>
653
654
<p>
655
The following steps can then be used to build openMSX:</p>
656
<ul>
657
<li>Open a Visual Studio command prompt</li>
658
	<li>Go to the <em>top of the openMSX source tree</em></li>
659
	<li>To build 3rd party libraries, type <code>msbuild -p:Configuration=<strong>Release</strong>;Platform=<strong>x64</strong> build\3rdparty\3rdparty.sln</code></li>
660
	<li>To build openMSX, type <code>msbuild -p:Configuration=<strong>Release</strong>;Platform=<strong>x64</strong> build\msvc\openmsx.sln</code></li>
661
</ul>
662
663
<p>The openMSX executable will be generated in <code>derived\x64-VC-Release\install</code>.</p>
664
<p>To build for other platforms or configurations, simply replace &quot;Release&quot; and
665
&quot;x64&quot;&nbsp;in the command lines above with the desired options.</p>
666
<p>To build using the Visual C++ IDE, simply open the aforementioned solution files and from the Build menu select &quot;Build Solution&quot;. This is the same as building from the command line using <code>msbuild</code>.</p>
667
<h3><a id="installstandalone">5.2 Installation</a></h3>
668
669
<!-- TODO - generalize this for both MinGW and VC++, integrate into make install -->
670
<!-- TODO - ensure wxCatapult is optional -->
671
<h4>Visual C++</h4>
672
<p>
673
The following step creates .zip and .msi installation packages for openMSX on Windows using WiX:</p>
674
<ul>
675
	<li>Build <a href="#standalone_compilation">openMSX</a> and
676
	<a class="external" href="http://openmsx.org/catapult-manual/compile.html">wxCatapult</a>
677
	for a given platform (Win32 or x64) and configuration (usually Release builds)</li>
678
	<li>Go to the <em>top of the openMSX source tree</em></li>
679
	<li>Run <code>build\package-windows\package.cmd <strong>platform configuration</strong>
680
	<strong>catapult_source_path</strong></code>:<ul>
681
		<li><strong>platform</strong> is one of { Win32, x64 }</li>
682
		<li><strong>configuration</strong> is one of { Release, Developer, Debug }</li>
683
		<li><strong>catapult_source_path</strong> is the path to the wxCatapult directory</li>
684
	</ul>
685
	</li>
686
</ul>
687
688
<p>An example command line (for 64 bit) could be:</p>
689
<div class="commandline">
690
	build\package-windows\package.cmd x64 Release ..\wxCatapult</div>
691
692
<p>The resulting package files can be found in <code>derived\x64-VC-Release\package-windows.</code></p>
693
694
<h2><a id="next">7. Next Steps</a></h2>
695
696
<p>
697
If all went well, you should have openMSX installed now or have a stand-alone working binary.
698
You can test it by executing openMSX from the command line:
699
</p>
700
<div class="commandline">
701
openmsx
702
</div>
703
704
<p>
705
or, by double-clicking the openMSX executable or icon that resulted
706
from the previous step.
707
</p>
708
709
<p>
710
You should get a screen similar to this:
711
</p>
712
<div class="commandline"><pre>
713
C-BIOS 0.25        cbios.sf.net
714
715
No cartridge found.
716
717
This version of C-BIOS can
718
only start cartridges.
719
Please restart your MSX
720
(emulator) with a cartridge
721
inserted.
722
</pre></div>
723
724
<p>
725
C-BIOS MSX2+ is the default system BIOS used by openMSX.
726
It was written from scratch by BouKiCHi, who was kind enough to let us
727
distribute it together with openMSX.
728
It is not perfect yet, but it runs many ROM games well.
729
Nowadays C-BIOS is a separate (SourceForge.net) project, with its own <a class="external" href="http://cbios.sourceforge.net/">web page</a>.
730
</p>
731
732
<p>
733
If you have a ROM image ready, you can try to run it with C-BIOS:
734
</p>
735
<div class="commandline">
736
openmsx ~/msx/games/my-favourite-game.rom
737
</div>
738
739
<p>
740
or, you can just drop it on the openMSX executable.
741
</p>
742
743
<p>
744
The next step would be to read the
745
<a class="external" href="setup.html">openMSX Setup Guide</a>.
746
That document describes how you can configure openMSX to emulate
747
actual MSX machines, such as the Panasonic FS-A1GT (turboR).
748
It also describes how you can have openMSX start up with your
749
personal settings, how you can configure openMSX and your system
750
for optimal performance and several other configuration related
751
topics.
752
And finally there is of course the
753
<a class="external" href="user.html">openMSX User's Manual</a>,
754
which describes all the things you can do with openMSX once
755
it is fully running.
756
</p>
757
758
<p>
759
If you got stuck somewhere in the compilation and installation process,
760
please contact us. The next chapter will tell you how.
761
</p>
762
763
<h5>macOS</h5>
764
765
<p>
766
You can run the openMSX application folder from Finder or from the command line:
767
</p>
768
<div class="commandline">
769
open derived/&lt;cpu&gt;-darwin-&lt;flavour&gt;-3rd/bindist/openMSX.app
770
</div>
771
772
<h2><a id="contact">8. Contact Info</a></h2>
773
774
<p>
775
Since openMSX is still under heavy development, feedback and bug reports are very
776
welcome!
777
</p>
778
779
<p>
780
Should you encounter problems, you have several options:
781
</p>
782
783
<ol>
784
<li>
785
Go to our IRC channel: <a class="external" href="ircs://irc.libera.chat:6697/#openMSX"><code>#openMSX</code> on <code>libera.chat</code></a>
786
and ask your question there. Also reachable via <a class="external" href="https://web.libera.chat/#openMSX">webchat</a>! If you don't get a reply immediately, please stick around for a while, or use one of the other contact options. The majority of the developers live in time zone GMT+1. You may get no response if you contact them in the middle of their night...
787
</li>
788
<li>
789
Post a message on <a class="external" href="http://www.msx.org/forum/semi-msx-talk/openmsx">the openMSX forum on MRC</a>.
790
</li>
791
<li>
792
Create a new issue in the
793
<a class="external" href="https://github.com/openMSX/openMSX/issues">openMSX issue tracker</a>
794
on GitHub.
795
You need a (free) log-in on GitHub to get access.
796
</li>
797
<li>
798
Contact us and other users via one of the mailing lists. If you're a regular user and want to discuss openMSX and possible issues,
799
join our <code>openmsx-user</code> mailing list.
800
If you want to address the openMSX developers directly,
801
post a message to the <code>openmsx-devel</code> mailing list.
802
More info on the
803
<a class="external" href="https://sourceforge.net/p/openmsx/mailman">openMSX mailing lists</a>,
804
including an archive of old messages, can be found at SourceForge.
805
</li>
806
</ol>
807
808
<p>
809
In all cases, please provide as much information as possible when you describe your
810
bug or request.
811
</p>
812
813
<h4>GCC / clang</h4><p>For experienced users: if you get a crash or a hang,
814
try to provide a <code>gdb</code> backtrace.
815
This will only work if you did not strip the openMSX binary
816
of its debug symbols.</p>
817
818
<p>Another useful thing to do is to install the debug versions of libstdc++ and libc6,
819
and then run openMSX with an <code>LD_LIBRARY_PATH=/usr/lib/debug</code> exported in the environment.
820
This will give a more detailed stack trace, especially in optimized code.
821
</p>
822
823
<h4>Visual C++</h4><p>For experienced users: if you get a crash or a hang,
824
try to provide a user dump. This will work for any openMSX binary, including
825
pre-built binaries obtained from <a class="external" href="http://openmsx.org/">openmsx.org</a>.</p>
826
<p>On Windows you can find user dump files for crashed processes
827
in the &quot;%LocalAppData%\CrashDumps&quot; directory. The default Windows crash dump
828
behaviour can be further customized as per
829
<a href="http://msdn.microsoft.com/en-us/library/bb513638(VS.85).aspx">MSDN</a>.</p>
830
<p>To generate a user dump on demand on any Windows OS, please read
831
<a class="external" href="http://support.microsoft.com/kb/286350">KB286350</a>.</p>
832
833
</body>
834
</html>