Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > 080316c9fbc1b2843ac734cf156e71c0 > files > 10

openmsx-0.7.2-7mdv2010.0.x86_64.rpm

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link title="Purple" rel="stylesheet" href="manual-purple.css" type="text/css" />
<link title="Minty" rel="alternate stylesheet" href="manual-minty.css" type="text/css" />
<link title="Plain" rel="alternate stylesheet" href="manual.css" type="text/css" />
<title>openMSX Compilation Guide</title>
</head>

<body>

<h1>openMSX Compilation Guide</h1>

<h2>Contents</h2>
<ol class="toc">
	<li><a class="internal" href="#intro">1. Introduction</a>
		<ol class="toc">
			<li><a class="internal" href="#newver">1.1 New Versions of this Document</a></li>
			<li><a class="internal" href="#purpose">1.2 Purpose</a></li>
			<li><a class="internal" href="#contrib">1.3 Contributors</a></li>
			<li><a class="internal" href="#history">1.4 Revision History</a></li>
		</ol>
	</li>
	<li><a class="internal" href="#preparation">2. Preparation</a>
		<ol class="toc">
			<li><a class="internal" href="#tools">2.1 Build Tools</a></li>
			<li><a class="internal" href="#libs">2.2 Libraries</a></li>
		</ol>
	</li>
	<li><a class="internal" href="#getsource">3. Getting the Source Code</a>
		<ol class="toc">
			<li><a class="internal" href="#getrelease">3.1 Released Version</a></li>
			<li><a class="internal" href="#getsvn">3.2 SVN Checkout</a></li>
			<li><a class="internal" href="#getsnapshot">3.3 SVN Snapshot</a></li>
		</ol>
	</li>
	<li><a class="internal" href="#local">4. Binary for Local System</a>
		<ol class="toc">
			<li><a class="internal" href="#compilelocal">4.1 Compilation</a></li>
			<li><a class="internal" href="#installlocal">4.2 Installation</a></li>
		</ol>
	</li>
	<li><a class="internal" href="#standalone">5. Stand-alone Binary</a><ol class="toc">
		<li><a class="internal" href="#compilestandalone">5.1 Compilation</a></li>
		<li><a class="internal" href="#installstandalone">5.2 Installation</a></li>
	</ol>
	</li>
	<li><a class="internal" href="#next">6. Next Steps</a></li>
<li><a class="internal" href="#contact">7. Contact Info</a></li>
</ol>

<h2><a id="intro">1. Introduction</a></h2>

<h3><a id="newver">1.1 New Versions of this Document</a></h3>
<p>
The latest version of the openMSX manual can be found on the openMSX home page:
</p>
<p>
<a class="external" href="http://openmsx.sourceforge.net/manual/">http://openmsx.sourceforge.net/manual/</a>
</p>
<p>
You can also use this URL to get up-to-date versions of the hyperlinks
if you printed out this manual.
</p>

<h3><a id="purpose">1.2 Purpose</a></h3>
<p>
This guide is about openMSX, the open source MSX emulator that tries to achieve
near-perfect emulation by using a novel emulation model.
You can find more information about openMSX on the
<a class="external" href="http://openmsx.sourceforge.net/">openMSX home page</a>.
</p>

<p>
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:
</p>
<ul>
<li>There is not yet a pre-packaged version for your favourite platform.</li>
<li>You want to closely follow the latest developments.</li>
<li>You want to make changes to openMSX.</li>
</ul>

<p>
If you need help compiling openMSX, please
<a class="internal" href="#contact">contact us</a>.
If you needed any modifications to make openMSX compile,
please send those modifications to us,
so we can make openMSX ever more portable.
</p>

<h3><a id="contrib">1.3 Contributors</a></h3>

<p>
The following people contributed to this document in one way or another:
</p>
<ul>
<li>Jorrith Schaap</li>
<li>Manuel Bilderbeek</li>
<li>Maarten ter Huurne</li>
<li>other openMSX developers</li>
</ul>
<p>
Thanks to all of them!
</p>

<h3><a id="history">1.4 Revision History</a></h3>

<p>
For the revision history, please refer to the <a class="external"
href="http://svn.sourceforge.net/viewvc/openmsx/openmsx/trunk/doc/manual/compile.html?view=log">SVN log</a>.
</p>

<h2><a id="preparation">2. Preparation</a></h2>

<p>
Before you can start compiling openMSX, you have to make sure your system
has all the necessary build tools installed, as well as the libraries
openMSX depends upon. The following sections tell you how you can prepare your system.
</p>
<p>
Every section starts with generic instructions, that apply to all platforms and
compilers. At the end of each section, platform specific notes cover differences or additional steps for certain platforms
or compilers.
</p>

<h3><a id="tools">2.1 Build Tools</a></h3>

<p>
For compilation, you need <a class="external" href="http://www.python.org/download/">Python</a>, a C++ compiler, and some compiler-specific programs.
If you have compiled packages from source before, you probably have some of these installed already.
</p>

<dl>

<dt><a class="external" href="http://www.python.org/download/">Python</a></dt>
<dd>A compact and dynamic programming language. Version 2.5 or later is
required. However, Python 3.0 contains incompatible changes in the language, so
make sure you install a version from the 2.x series. Eventually Python will
replace Make completely in our build system, but at the moment both are
required. Note: on Windows 7 you may have to add the path to Python (e.g. <code>C:\Python26</code>) to your <code>PATH</code> manually.</dd>
<dt>There are two compilers that are can be used to build openMSX: gcc
and Visual C++. The gcc compiler builds openMSX on all supported platforms,
while Visual C++ is an alternative option on Windows.</dt>

</dl>

<h4>gcc</h4>

<p>For compilation with gcc, you need GNU Make and g++:</p>

<dl>

<dt>make</dt>
<dd>GNU implementation of the Make tool.
Make interprets rules that define how a project should be built.
Version 3.79 or higher should suffice, but 3.80 or higher is recommended and even necessary if you are building a standalone binary with the method described below.</dd>

<dt>g++</dt>
<dd>The GNU C++ compiler.
Version 4.1 or later is recommended; any version lower than 3.4 will not be able to build openMSX at all.
</dd>

</dl>

<h5>Mac OS X</h5>

<p>
Install the Xcode Tools from Apple, which you can find on the Mac OS X installation DVD. Alternatively, you can download it from the <a class="external" href="http://connect.apple.com/">Apple Developer Connection</a> (free registration required).
The Xcode Tools package contains up-to-date versions of Make, GCC and SVN. If you are running Mac OS X 10.5 (Leopard), make sure you also install support for compiling for Mac OS X 10.3 (Panther), which is an optional component.
</p>
<p>
Note that Mac OS X 10.3 uses GCC 3.3 as the system compiler, which is not able to compile openMSX. The easy solution for this is to use a Mac with OS X 10.4 or 10.5 and compile a stand-alone binary (see next section), which will run on 10.3 as well. An alternative would be to get a more recent GCC running on OS X 10.3, but that <a class="external" href="http://www.figuiere.net/hub/blog/?2006/09/14/452-gcc-40-on-macos-x-103">seems to be problematic</a>.
</p>

<h5>Microsoft Windows</h5>

<p>You need to install MinGW and MSYS.</p>

<p>You can download MinGW and MSYS from <a class="external" href="http://sourceforge.net/project/showfiles.php?group_id=2435">the download page</a> of the MinGW project. Download the latest version of the "Automated MinGW Installer" (5.1.4 is the latest at the time of writing) and download also "MSYS Base System" (use 1.0.11 Release Candidate or newer, if available, because 1.0.10 is too old), i.e. the installer <code>.exe</code> file.
Double click on the MinGW package after downloading, choose "Download and Install", Package "Current" and add component "g++". Use the default installation directory (<code>C:\MinGW</code>), or at least a directory without spaces and <strong>not</strong> a network folder (i.e. shared folder on another computer). For MSYS, the installer's default settings (destination directory <code>C:\msys\1.0</code>) will be OK. If you get questions in a post-install Command Prompt dialog, type: <code>y</code>, <code>y</code>, <code>C:/MinGW</code> (or the other directory you chose without spaces; but do note that you should use <em>forward slashes</em> in the path here!), <code>y</code>.
</p>

<p>Note: there is a bug in the <a class="external" href="https://sourceforge.net/project/showfiles.php?group_id=2435&amp;package_id=11598">MinGW Runtime (mingwrt)</a> package version 3.15.1, which will cause FreeType not to compile (and probably more). Make sure you have the latest (newer) version installed! (Which will be the case if you do a fresh install using the instructions above.)
</p>

<h4>Visual C++</h4>

<p>There are three different ways to obtain the Visual C++ compiler:</p>
<dl>

<dt>
<a class="external" href="http://msdn.microsoft.com/en-us/vstudio/default.aspx">Visual C++ 2008</a></dt>
<dd>This is the professional IDE that comes with Visual Studio, as a standalone
purchase, or via an MSDN subscription.</dd>

	<dt>
	<a class="external" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&amp;displaylang=en">Windows SDK</a></dt>
	<dd>This is a free (as in beer) command line environment that provides a full set of compilers, headers and libraries. This is the best option for people who simply wish to build openMSX with minimal hassle. Any <a class="external" href="http://msdn.microsoft.com/en-us/windows/bb980924.aspx">recent version</a> will work; we use the one labeled <a class="external" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC"> Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5</a>. (You can uncheck Documentation, Samples and .NET Development Tools if you wish to save some disk space. This brings the download from 1.2GB to 102MB...)</dd>
	<dt><a class="external" href="http://www.microsoft.com/express/vc/">Visual C++ 2008 Express</a></dt>
	<dd>This is a free (again as in beer) IDE and development environment. It builds 32-bit binaries out of the box, and can be made to build 64-bit binaries with some <a class="external" href="http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/38544c63-d12a-4a05-9ea7-5b4124152801/"> coaxing</a>. This is the best option for developers looking to browse the code or use other benefits of an IDE. It's also a smaller download than the Windows SDK.</dd>
	<dt>For compilation with Visual C++, you need the <a class="external" href="http://msdn.microsoft.com/en-us/directx/aa937788.aspx">DirectX SDK</a>.
	To generate an MSI installer, you need <a class="external" href="http://wix.sourceforge.net/">WiX</a>.</dt>

</dl>

<dl>

	<dt>
<a class="external" href="http://msdn.microsoft.com/en-us/directx/aa937788.aspx">DirectX SDK</a></dt>
<dd>SDK containing DirectX headers and libs. Any <a class="external" href="http://msdn.microsoft.com/en-us/directx/aa937788.aspx">recent version</a> will work; we use the one from <a class="external" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=5493F76A-6D37-478D-BA17-28B1CCA4865A">November 2008</a>. This (too) is a large download, about 480MB. During installation you can choose to uncheck the Documentation, Samples and Source Code.</dd>

<dt> <a class="external" href="http://wix.sourceforge.net/">WiX</a></dt>
<dd>A tool that generates MSI installers. Version 3.0 (currently in RC) or higher is required (<a class="external" href="https://sourceforge.net/project/showfiles.php?group_id=105970">download here)</a>. If you get a message that Vortive won't install, that's no problem, just continue.</dd>

</dl>
	<h3><a id="libs">2.2 Libraries</a></h3>

<p>
openMSX depends on the following libraries:
</p>
<dl>

<dt><a class="external" href="http://www.libsdl.org/">SDL</a></dt>
<dd>Simple DirectMedia Layer, a cross-platform library that provides low-level access to video, audio and input devices.</dd>

<dt><a class="external" href="http://www.libsdl.org/projects/SDL_image/">SDL_image</a></dt>
<dd>Library that integrates image reading with SDL. SDL_image can support many image formats, but openMSX only requires PNG support.</dd>

<dt><a class="external" href="http://www.libsdl.org/projects/SDL_ttf/">SDL_ttf</a></dt>
<dd>Library that provides support for TrueType Fonts in SDL.</dd>

<dt><a class="external" href="http://www.libpng.org/pub/png/libpng.html">libpng</a></dt>
<dd>Library for handling PNG images.</dd>

<dt><a class="external" href="http://www.xmlsoft.org/">libxml2</a></dt>
<dd>XML C library, originally developed for GNOME.</dd>

<dt><a class="external" href="http://www.zlib.org/">zlib</a></dt>
<dd>Library for file compression.</dd>

<dt><a class="external" href="http://www.tcl.tk/">Tcl</a></dt>
<dd>The Tool Command Language, an embeddable scripting language. openMSX requires Tcl 8.4; version 8.3 will not work.</dd>

<dt><a class="external" href="http://www.opengl.org/">OpenGL</a> (optional)</dt>
<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>

<dt><a class="external" href="http://glew.sourceforge.net/">GLEW</a> (optional)</dt>
<dd>The OpenGL Extension Wrangler, a library that greatly simplifies the use of OpenGL extensions.</dd>

<dt><a class="external" href="http://jackaudio.org/">JACK</a> (optional)</dt>
<dd>The JACK Audio Connection Kit is a sound server that provides low latency connections between audio applications. Currently openMSX can use JACK only for connecting the cassette port (CassetteJack).</dd>

</dl>

<h4>gcc</h4>
<p>
You can install the required libraries systemwide, or you can use the "3rd party libraries" support in the openMSX build system and build a stand-alone binary. Systemwide is recommended if you run a modular operating system (such as Linux, BSD or Mac OS X with MacPorts 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 Mac OS X 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.
</p>
<h5>Debian and Ubuntu Linux</h5>
<p>
You can easily install all required packages using the "build dependencies" feature of the APT package manager:
</p>
<div class="commandline">
sudo apt-get build-dep openmsx
</div>

<h5>Other Linux</h5>
<p>
Most Linux distributions have libraries split over two packages: a runtime package and a development package.
The runtime package for the "Foo" library is typically called
<code>libfoo</code>, the development package is typically named
<code>libfoo-dev</code> or <code>libfoo-devel</code>.
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.
</p>

<h5>Mac OS X</h5>

<p>
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. If you want to do things manually, you can get the libraries from either
<a class="external" href="http://www.macports.org/">MacPorts</a>
or
<a class="external" href="http://www.finkproject.org/">Fink</a>. These are tools to give you access to a large collection of software packages (or ports). You can use them to install those packages (or ports).
If you are using MacPorts, you should install the ports
<code>libpng</code>, <code>libsdl</code> and <code>libsdl_image</code>.
If you are using Fink, you should install the packages
<code>libpng3</code>, <code>sdl</code> and <code>sdl-image</code>.
</p>

<h5>Microsoft Windows</h5>

<p>
We strongly recommend using the <a class="internal" href="#standalone">Stand-alone
Binary</a> method, which means the openMSX build system will download and compile all libraries automatically.
</p>

<h4>Visual C++</h4>

<p>
When building with Visual C++, the optional libraries mentioned above are
arranged as follows:</p>
<ul>
	<li>Headers and libraries for OpenGL are included with Visual C++.</li>
	<li>The GLEW library is required.</li>
	<li>The JACK library is not supported.</li>
</ul>
<p>
Also, when building with Visual C++, the &quot;3rd party libraries&quot; support in the openMSX
build system must be used. The resulting binary statically links in all
dependencies, including the C runtime. For more details, please see the <a class="internal" href="#standalone">
Stand-alone Binary</a> chapter.
</p>
<h2><a id="getsource">3. Getting the Source Code</a></h2>

<p>
openMSX is developed using the tools
<a class="external" href="http://www.sourceforge.net/">SourceForge.net</a>
freely offers to open source projects.
The code is stored in Subversion (SVN), an open source version management system.
Once in a while an openMSX release is made.
</p>

<p>
There are several options for getting the source code:
</p>

<dl>

<dt><a class="internal" href="#getrelease">Released Version</a></dt>
<dd>
These are tested versions, which should give you little problem compiling
and running.
However, as openMSX development if often quite fast, they may not have all
the latest features.
Also there could be bugs that have been fixed since the last release.
</dd>

<dt><a class="internal" href="#getsvn">SVN Checkout</a></dt>
<dd>
Through SVN you can get the same development version the
openMSX developers are using.
This is the bleeding edge:
the latest stuff, which may be great or may be horribly broken.
Usually openMSX SVN compiles and runs fine, but we're only human,
so once in a while it breaks.
Also there may be changes that are not documented yet.
</dd>

<dt><a class="internal" href="#getsnapshot">SVN Snapshot</a></dt>
<dd>
A snapshot is created from a recent SVN checkout,
in a <code>tar.gz</code>  archive.
A snapshot is therefore quite similar to a SVN checkout,
but it doesn't require you to install and use SVN. <strong>We really do not recommend to use SVN snapshots anymore, as they are usually very outdated and have other disadvantages.</strong>
</dd>

</dl>

<p>
Releases are intended for general users, SVN and SVN snapshots are intended for
(would be) developers, heavy testers and people who want to follow new
developments closely. It might be a good idea to play with a release first. If
you like what you see and want to get in deeper, you can switch to SVN later.
If you update often, it is best to use a SVN checkout rather than
a SVN snapshot, because with a checkout you can do efficient incremental
updates, saving network bandwidth and compile time.
</p>

<p>
If you downloaded a version that is either a lot older or a lot newer than
this guide, it is a good idea to read the guide included in your downloaded
version instead of the version you're reading right now.
You can find the Compilation Guide in the directory
<code>doc/manual</code>.
</p>

<h3><a id="getrelease">3.1 Released Version</a></h3>

<p>
You can download a released version of openMSX from
<a class="external" href="http://sourceforge.net/project/showfiles.php?group_id=38274"
>the download page at SourceForge</a>.
The latest version is probably the best one. This guide assumes that you are using the latest release.
</p>

<p>
After downloading, type the following in a UNIX or MSYS shell, or use another
decompression tool:
</p>
<div class="commandline">tar xzvf openmsx-VERSION.tar.gz</div>
<p>
in which <code>VERSION</code> is the openMSX version you downloaded, or use the
file name you saved the tar.gz file with. The directory that is created by uncompressing the <code>tar.gz</code> file
is called <em>the top of the source tree</em>.
</p>

<h3><a id="getsvn">3.2 SVN Checkout</a></h3>

<p>
Getting a SVN checkout means you use SVN to retrieve the latest version
of the source code of openMSX.
This means you will need to install an SVN client.
This package is usually named <code>subversion</code>.
There are graphical front-ends for SVN,
but this guide will tell you how to use SVN from the command line. More information about SVN can be found on the <a class="external"
href="http://svnbook.red-bean.com/en/1.1/">Subversion book</a> site.</p>
<p>
Windows
users might want to look at <a class="external" href="http://www.sliksvn.com/en/download">SlikSVN</a> for a command line tool, <a class="external" href="http://tortoisesvn.tigris.org/">TortoiseSVN</a> for Windows Explorer integration, or <a class="external" href="http://ankhsvn.open.collab.net/">ankhSVN</a> for Visual Studio integration.
</p>

<p>
With the following line you can retrieve the latest sources (also works on Windows when using SlikSVN):
</p>
<div class="commandline">
svn co https://openmsx.svn.sourceforge.net/svnroot/openmsx/openmsx/trunk openMSX
</div>
<p>
In this line you specified where you want to retrieve the files from
(host name of the SVN server),
what project you want to retrieve (<em>openmsx</em> in this case), what
module you want to get (<em>openmsx</em> in this case, which is the module that contains
the sources of the main openMSX program), which branch you want
to retrieve (<em>trunk</em> in this case, which is the main development branch) and what directory it should be
checked out to (we chose <em>openMSX</em> in this example).
</p>

<p>In TortoiseSVN, use <code>https://openmsx.svn.sourceforge.net/svnroot/openmsx/openmsx/trunk</code> as
the "URL of repository&quot; and the directory of your choice as the "Checkout directory". Use the <code>HEAD</code> revision and click OK.
When compiling openMSX on Windows with gcc, it's often convenient to use <code>C:\msys\1.0\home\&lt;username&gt;\openMSX</code>
as the checkout directory, as this is easy to reach from an MSYS shell - it's
your MSYS home directory.
</p>

<p>
If you're a developer, it makes sense to add the following option to the svn commandline as well:
</p>
<div class="commandline">
--username &lt;name-of-your-sourceforge-account&gt;
</div>

<p>
The SVN command created a directory called <code>openMSX</code> for you
in the current directory (or in the "Checkout directory" you specified in TortoiseSVN). In addition to the openMSX code, you will see hidden
SVN administration directories which are all called <code>svn</code> or
<code>.svn</code>.
Do not mess with these (nor move contents of this checkout directory around), otherwise SVN will get confused.
This directory created by SVN is what we will call in this manual <em>the top
of the source tree</em>.
</p>

<p>
If you want to update your source tree later,
go to the top of the source tree and type:
</p>
<div class="commandline">
svn up
</div>
<p>
or right click on the openMSX directory in Windows Explorer and select "SVN Update".
</p>

<h3><a id="getsnapshot">3.3 SVN Snapshot</a></h3>

<p>As we stated above: better not use this anymore.</p>

<!--
<p>
First, download the <a class="external" href="http://openmsx.sourceforge.net/temp/openmsx-SVN-snapshot.tar.gz" >most recent SVN snapshot</a>.
</p>

<p>
After downloading, type the following in a UNIX or MSYS shell, or use another decompression tool:
</p>
<div class="commandline">tar xzvf openmsx-SVN-snapshot.tar.gz</div>
<p>
The directory that is created by uncompressing the <code>tar.gz</code> file is called <em>the top of the source tree</em>.
</p>
-->
<h2><a id="local">4. Binary for Local System</a></h2>

<p>
This section explains how to build openMSX for a local system. If you want to create a binary that runs everywhere, we recommend you to skip this chapter and use the <a class="internal" href="#standalone">stand-alone binary</a> method. We also recommend to do that for Mac OS X and especially for Microsoft Windows systems.
</p>

<h3><a id="compilelocal">4.1 Compilation</a></h3>

<p>
Now that all the necessary tools and libraries are installed,
you are almost ready to start the actual compilation of openMSX.
</p>
<h4>gcc</h4>

<p>
The first thing you may want to know is that you can build openMSX in
different flavours. The default flavour depends on the CPU, but is always one that is optimized for performance. For example for x86 processors the default
flavour is "i686": i.e., with optimisations for Pentium II and higher,
without any debugging stuff. Note: On an older VIA Epia (with the Samuel 2 CPU at least), a binary built with "i686" flavour will not run. Please
use the "opt" flavour for that platform.
</p>
<p>
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:
</p>
<div class="commandline">
export OPENMSX_FLAVOUR=devel
</div>
<p>
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>.
</p>

<p>
You can select the C++ compiler to be used like this:
</p>
<div class="commandline">
export CXX=g++-4.2
</div>
<p>
This can be useful if the default compiler on your system is an old GCC version which is either not capable of compiling openMSX, or generates less efficient code.
</p>

<p>
Now we can let a script check if you have indeed all necessary libraries and headers installed.
Go to the top of your openMSX source tree and run the following script:
</p>
<div class="commandline">
./configure
</div>
<p>
This script will report what versions of libraries you have installed.
It also reports which components can be built with those libraries.
If the script reports that it can't build the openMSX core component,
you should install the missing ones before you can continue.
Otherwise, you can decide to install the libraries needed for the optional
components, or to continue without building some components (e.g. the OpenGL based renderers).
</p>

<p>
If installing the correct libraries doesn't help,
<a class="internal" href="#contact">contact the openMSX developers</a>.
If you file a bug report, please attach the <code>probe.log</code> file
that is written by the <code>configure</code> script in the directory
<code>derived/&lt;cpu&gt;-&lt;os&gt;-&lt;flavour&gt;/config/</code>.
</p>

<p>
You can customise the build process by editing the file
<code>build/custom.mk</code>.
The most likely thing you might want to customise is the installation directory (<code>INSTALL_BASE</code>).
If you are installing openMSX on a system on which you do not have
superuser (root) privileges, you can set the installation directory
to a subdirectory of your home directory.
</p>

<p>
After successfully running <code>configure</code>,
it's time to compile everything.
To start compilation, type:
</p>
<div class="commandline">
make
</div>
<p>
Depending on how fast your system is,
this may take several minutes to half an hour.
</p>

<p>
If you get errors during compilation,
there may be something wrong that was not detected by configure.
Verify that you installed
<a class="internal" href="#libs">all required libraries</a>,
both the run time and development packages.
If that doesn't help, or we forgot to list a library openMSX depends on,
<a class="internal" href="#contact">contact the openMSX developers</a>.
Make sure you provide us with the error message you got.
</p>

<h5>Mac OS X</h5>

<p>
By default, openMSX is compiled for the type of CPU that is present in your Mac. If you want to build for a different CPU, use <code>export OPENMSX_TARGET_CPU=ppc</code> (PowerPC) or <code>export OPENMSX_TARGET_CPU=x86</code> (Intel). If you want to build a universal binary, use <code>export OPENMSX_TARGET_CPU=univ</code>.
</p>
<p>
If you have a G4 or better PPC CPU, using <code>export OPENMSX_FLAVOUR=ppcg4</code> may give you a faster openMSX executable.
</p>

<h4>Visual C++</h4>

<p>
While it is possible to configure the supplied Visual C++ project files to
dynamically link against import libraries, this is not currently supported.</p>
<h3><a id="installlocal">4.2 Installation</a></h3>

<h4>gcc</h4>

<p>
To install openMSX, run the following command:
</p>
<div class="commandline">
make install
</div>
<p>
This installs openMSX, by default in <code>/opt/openMSX</code>.
Note that only root has rights to write to system-wide directories such as
<code>/opt</code>,
so you may have to do <code>su</code> before <code>make install</code>, or use <code>sudo</code>.
</p>

<h5>Mac OS X</h5>

<p>
On Mac OS X, the build creates an application folder. You can "install" this by copying it to a different location. The application folder will depend on systemwide installed libraries, so it will not work on Macs without those libraries.
</p>
<p>
You can run openMSX from the application folder with the following command:
</p>
<div class="commandline">
open derived/&lt;cpu&gt;-darwin-&lt;flavour&gt;/bindist/openMSX.app
</div>
<p>
If you want to see the messages openMSX prints to stdout and stderr, start openMSX like this:
</p>
<div class="commandline">
derived/&lt;cpu&gt;-darwin-&lt;flavour&gt;/bindist/openMSX.app/Contents/MacOS/openmsx
</div>

<h2><a id="standalone">5. Stand-alone Binary</a></h2>

<p>
This chapter describes how to build a binary of openMSX that does not depend on any library except those that are available on the platform by default. This procedure is highly recommended on Microsoft Windows. It is also recommended on Mac OS X if you are not a MacPorts or Fink user.
</p>

<p>
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>

<h3><a id="compilestandalone">5.1 Compilation</a></h3>

<h4>gcc</h4>
<p>
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.
</p>

<p>
Just like for normal 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>.
</p>

<p>
To build a stand-alone binary, run the following command at the top of the source tree:
</p>
<div class="commandline">
make staticbindist
</div>
<p>
The final output files will be produced in <code>derived/&lt;cpu&gt;-&lt;os&gt;-&lt;flavour&gt;-3rd/bindist</code>.
</p>

<h5>Mac OS X</h5>

<p>
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.
</p>

<h5>Microsoft Windows</h5>

<p>
Here's the very short version if you want quick results on Microsoft Windows
with gcc:
</p>
<ul>
<li>Open an MSYS shell</li>
<li>Go to the <em>top of the source tree</em> (e.g.: <code>cd openMSX</code> if you chose the MSYS home directory as checkout directory)</li>
<li>Type: <code>make staticbindist</code></li>
</ul>
<p>A complete package will be created in <code>derived\x86-mingw32-i686-3rd\bindist\install</code>.
</p>

<p>
If you additionally want to build the openMSX installer, you should refer to the <code>package-win32</code> module in our Subversion repository. It contains a README file with a manual.
</p>

<p>
Note: on a 64-bit Windows system, MinGW will pretend to have built 64-bit binaries (target directory is <code>derived\x86_64-mingw32-opt-3rd\bindist\install</code>), but they're actually just 32-bit.
</p>

<h4>Visual C++</h4>

<p>When building with Visual C++, the result is a static executable with minimal
dynamic library dependencies. Two platforms are supported:</p>
<ul>
	<li>Win32 - a 32-bit binary that runs on both 32 and 64-bit versions of Windows</li>
	<li>x64 - a 64-bit binary that runs only on 64-bit versions of Windows</li>
</ul>
<p>Three different configurations are supported:</p>
<ul>
	<li>Debug: assertions enabled, debug prints enabled, no optimization</li>
	<li>Developer: assertions enabled, debug prints disabled, no optimization</li>
	<li>Release: assertions disabled, debug prints disabled, full optimization</li>
</ul>
<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 C++ 2008, it will be in &quot;Microsoft Visual Studio 2008\Visual Studio Tools&quot; as the &quot;Visual Studio 2008 Command Prompt&quot;. For the Windows SDK, it will be in &quot;Microsoft Windows SDK vX.Y&quot; as the &quot;CMD Shell&quot;</p>
<!-- TODO - Replace this section when we have integration with the broader 3rd party system -->
<p>In order to build openMSX, the libraries it depends on need to be
downloaded and unpacked:</p>
<ul>
	<li>Open a command prompt and go to the <em>top of the openMSX source tree</em></li>
	<li>Type <code>python build\3rdparty_download.py windows</code></li>
</ul>

<p>
The following steps can then be used to build openMSX:</p>
<ul>
<li>Open a Visual Studio command prompt</li>
	<li>Go to the <em>top of the openMSX source tree</em></li>
	<li>To build 3rd party libraries, type <code>msbuild -p:Configuration=<strong>Release</strong>;Platform=<strong>Win32</strong> build\3rdparty\3rdparty.sln</code></li>
	<li>To build openMSX, type <code>msbuild -p:Configuration=<strong>Release</strong>;Platform=<strong>Win32</strong> build\msvc\openmsx.sln</code></li>
</ul>

<p>The openMSX executable will be generated in <code>derived\Win32-VC-Release\install</code>.</p>
<p>To build for other platforms or configurations, simply replace &quot;Release&quot; and
&quot;Win32&quot;&nbsp;in the command lines above with the desired options.</p>
<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 exactly equivalent to building from the command line using <code>msbuild</code>.</p>
<h3><a id="installstandalone">5.2 Installation</a></h3>

<!-- TODO - generalize this for both MinGW and VC++, integrate into make install -->
<!-- TODO - ensure wxCatapult is optional -->
<h4>Visual C++</h4>
<p>
The following step creates .zip and .msi installation packages for openMSX on Windows using WiX:</p>
<ul>
	<li>Build <a href="#standalone_compilation">openMSX</a> and
	<a class="external" href="http://openmsx.sourceforge.net/catapult-manual/compile.html">wxCatapult</a>
	for a given platform (Win32 or x64) and configuration (usually Release builds)</li>
	<li>Go to the <em>top of the openMSX source tree</em></li>
	<li>Run <code>build\package-windows\package.cmd <strong>platform configuration</strong>
	<strong>catapult_source_path</strong></code>:<ul>
		<li><strong>platform</strong> is one of { Win32, x64 }</li>
		<li><strong>configuration</strong> is one of { Release, Developer, Debug }</li>
		<li><strong>catapult_source_path</strong> is the path to the wxCatapult directory</li>
	</ul>
	</li>
</ul>

<p>An example command line would be (for 64 bit):</p>
<div class="commandline">
	build\package-windows\package.cmd x64 Release ..\wxCatapult</div>

<p>The resulting package files can be found in <code>derived\x64-VC-Release\package-windows.</code></p>

<h2><a id="next">6. Next Steps</a></h2>

<p>
If all went well, you should have openMSX installed now or have a stand alone working binary.
You can test it by executing openMSX from the command line:
</p>
<div class="commandline">
openmsx
</div>

<p>
or, by double clicking the openMSX executable that resulted from the previous step.
</p>

<p>
You should get a screen similar to this:
</p>
<div class="commandline"><pre>
C-BIOS 0.21        cbios.sf.net

No cartridge found.

This version of C-BIOS can
only start cartridges.
Please restart your MSX
(emulator) with a cartridge
inserted.
</pre></div>

<p>
C-BIOS MSX2+ is the default system BIOS used by openMSX.
It was written from scratch by BouKiCHi and he was kind enough to let us
distribute it together with openMSX.
It is not perfect yet, but it runs many ROM games well.
Nowadays C-BIOS is a separate SourceForge.net project, with its own <a class="external" href="http://cbios.sourceforge.net/">web page</a>.
</p>

<p>
If you have a ROM image ready, you can try to run it with C-BIOS:
</p>
<div class="commandline">
openmsx ~/msx/games/my-favourite-game.rom
</div>

<p>
or, you can just drop it on the openMSX executable.
</p>

<p>
The next step would be to read the
<a class="external" href="setup.html">openMSX Setup Guide</a>.
That document describes how you can configure openMSX to emulate
actual MSX machines, such as the Panasonic FS-A1GT (turboR).
It also describes how you can have openMSX start up with your
personal settings, how you can configure openMSX and your system
for optimal performance and several other configuration related
topics.
And finally there is of course the
<a class="external" href="user.html">openMSX User's Manual</a>,
which describes all the things you can do with openMSX once
it is fully running.
</p>

<p>
If you got stuck somewhere in the compilation and installation process,
please contact us. The next chapter will tell you how.
</p>

<h5>Mac OS X</h5>

<p>
By default openMSX will not be in your search path.
So to start it, you will have to specify the full path on the command line.
For example:
</p>
<div class="commandline">
/opt/openMSX/bin/openmsx
</div>

<p>
If you built an application folder, you can run it from Finder or from the command line:
</p>
<div class="commandline">
open derived/&lt;cpu&gt;-darwin-app-&lt;flavour&gt;/bindist/openMSX.app
</div>

<p>
We do not have a finished GUI yet that works on Mac OS X, so you can either use openMSX from the command line for now, or use third party software like <a class="external" href="http://www5f.biglobe.ne.jp/~nekocan/group_soft/ht_soft.html">Nekolauncher openMSX</a> or <a class="external" href="http://www.cescoware.com/">openMSX Peashooter</a>.
</p>

<h5>Microsoft Windows</h5>

<p>
You can use the <a class="external" href="http://openmsx.sourceforge.net/catapult-manual/">
Catapult</a> launcher to run openMSX.</p>

<h2><a id="contact">7. Contact Info</a></h2>

<p>
Since openMSX is still under heavy development, feedback and bug reports are very
welcome!
</p>

<p>
If you encounter problems, you have several options:
</p>

<ol>
<li>
If you're a regular user and want to discuss openMSX and possible problems,
join our <code>openmsx-user</code> mailing list.
More info on the
<a class="external" href="http://sourceforge.net/mail/?group_id=38274">openMSX mailing lists</a>,
including an archive of old messages, can be found at SourceForge.
</li>
<li>
Go to our IRC channel: <code>#openMSX</code> on <code>irc.freenode.net</code>
and ask your question there. Also reachable via <a class="external" href="http://openmsx.sf.net/mibbit.php">Mibbit</a>! If you don't get a reply immediately, please stick around for a while, or ask your question on the mailinglist (see below).
</li>
<li>
If you want to address the openMSX developers directly,
post a message to the <code>openmsx-devel</code> mailing list.
More info on the
<a class="external" href="http://sourceforge.net/mail/?group_id=38274">openMSX mailing lists</a>,
including an archive of old messages, can be found at SourceForge.
</li>
<li>
Use one of the
<a class="external" href="http://sourceforge.net/tracker/?group_id=38274">openMSX trackers</a>
at SourceForge.
At the moment of writing, there are four trackers:
Bugs, Support Requests, Patches and Feature Requests.
</li>
<li>
Post a message on the forum on <a class="external" href="http://www.openmsx.org/">www.openmsx.org</a>.
</li>
</ol>

<p>
In all cases, please provide as much information as possible when you describe your
bug or request.
</p>

<h4>gcc</h4><p>For experienced users: if you get a crash or a hang,
try to provide a <code>gdb</code> backtrace.
This will only work if you did not strip the openMSX binary
of its debug symbols.</p>

<p>Another useful thing to do is to install the debug versions of libstdc++ and libc6,
and then run openmsx with an <code>LD_LIBRARY_PATH=/usr/lib/debug</code> exported in the environment.
This will give a more detailed stacktrace, especially in optimized code.
</p>

<h4>Visual C++</h4><p>For experienced users: if you get a crash or a hang,
try to provide a user dump. This will work for any openMSX binary, including
pre-built binaries obtained from <a class="external" href="http://www.openmsx.org/">www.openmsx.org</a>.</p>
<p>As of Windows Vista SP1, you can find user dump files for crashed processes 
in the &quot;%LocalAppData%\CrashDumps&quot; directory. The default Windows crash dump 
behavior can be further customized as per
<a href="http://msdn.microsoft.com/en-us/library/bb513638(VS.85).aspx">MSDN</a>.</p>
<p>To generate a user dump on demand on any Windows OS, please read
<a class="external" href="http://support.microsoft.com/kb/286350">KB286350</a>.</p>

<p class="version">
$Id: compile.html 10006 2009-06-07 21:09:51Z m9710797 $
</p>

</body>
</html>