Difference between revisions of "Building ReactOS"

From ReactOS Wiki
Jump to: navigation, search
m
m (For me source root is in output-MinGW-i386/reactos, I suppose it changed)
(48 intermediate revisions by 23 users not shown)
Line 1: Line 1:
 +
<!-- '''NOTE: This page is deprecated and is purely here for archival purposes. For instructions on building ReactOS, please see the [http://www.reactos.org/development/build-environment build environment] page of the development guide.''' -->
 
This page describes the steps necessary to build ReactOS.
 
This page describes the steps necessary to build ReactOS.
  
 
== Getting all you need ==
 
== Getting all you need ==
 +
=== Setting up a Build Environment ===
 +
For building ReactOS you also need the official [[ReactOS Build Environment]]. Please download and install it from that page.
 +
 +
Make sure that no interfering build environment (such as MSYS) is in your PATH environment variable when building.
 +
 +
<!-- {{Notice|Due to a current bug, the build environment can not use a build folder that contains spaces in its path name.<br />
 +
Under Windows XP and 2003 you  must change the default location of "C:\Documents and Settings\[username]\reactos\".}} -->
 +
=== Optional: Set Up Visual Studio ===
 +
If you want to use Visual Studio to compile ReactOS, you need to get one of the supported version, which is VS2010 and later. You can download the free Community Edition of Visual Studio 2015. To compile with VS, open the appropriate VS command prompt and follow the same instructions as for building with the GCC based ReactOS build environment. Note that you still need the ReactOS build environment, which contains CMake and some additional tools, or you can install the latest version of CMake yourself, but that is not recommended. If you experience problems with the configure stage, e.g. the compiler is reported to not be working, please check if you have installed any additional Windows SDKs or WDK and try again after removing them.
  
 
=== Getting a Working Copy ===
 
=== Getting a Working Copy ===
 +
The first step in building ReactOS is getting a copy of the source code.
 +
 +
You can use the exported release source code, but since you are reading this, you are probably interested in keeping up to date with the latest changes, so you will want a "working copy" of ReactOS.
 +
To get a working copy of ReactOS, please read the [[ReactOS_Git_For_Dummies|ReactOS Git For Dummies]] page.
 +
 +
You need to have [https://git-scm.com/ Git] installed on your system. The command
 +
git clone https://github.com/reactos/reactos.git
 +
from within the command prompt will download it.
 +
 +
== Prerequisites ==
 +
{{Notice|It is recommended to temporarily disable your antivirus before proceeding, because some of them detect some of ReactOS' system files (in particular, crtdll.dll) as being infected.}}
 +
 +
Before building either the tools or ReactOS itself the output location must be created and prepared. This is an easy step and involves only one command. This command is located in the root of recent revisions of the source code and can be run either from the root directory itself or any other directory you want the build your sources in. Please make sure you are running it from within ReactOS BE:
 +
 +
=== Linux/Unix ===
 +
Run:
 +
<syntaxhighlight lang="bash">
 +
configure.sh
 +
cd output-MinGW-i386/reactos
 +
</syntaxhighlight>
 +
 +
=== Windows or ReactOS ===
 +
Run:
 +
<syntaxhighlight lang="dos">
 +
configure.cmd
 +
cd output-MinGW-i386
 +
</syntaxhighlight>
 +
After executing, folder <tt>output-MinGW-i386</tt> will be created in root of ReactOS tree. You will be redirected to it.
 +
If you want to build in a different folder, cd to that folder first and then execute
 +
<code>
 +
<path_to_source>\configure.cmd
 +
</code>
 +
 +
configure.cmd currently supports the following options:
 +
* <code>/?</code> displays help
 +
* <code>Codeblocks</code> creates a CodeBlocks solution
 +
* <code>Eclipse</code> creates an Eclipse solution
 +
* <code>Makefiles</code> creates (n)make files
 +
* <code>clang</code> Uses clang instead of gcc
 +
* <code>VSSolution</code> Creates a Visual Studio solution
 +
* <code>RTC</code> enables extra runtime checks
 +
 +
You can additionally specify any number of cmake command line options, like "-DSYMBOL=VALUE".
  
The first step in building ReactOS is getting a copy of the source code.
+
=== Building ReactOS on Windows or ReactOS* ===
 +
From the build folder (e.g. reactos\output-MinGW-i386) enter the following command:
 +
<code>
 +
ninja COMMANDS
 +
</code>
  
You can use the exported release source code, but since you are reading this, you are probably interested in keeping up to date with the latest changes, so you will want a "working copy" of ReactOS.
+
Replace "COMMANDS" with the desired build commands, such as <code>bootcd</code> or <code>livecd</code>, listed below:
To get a working copy of ReactOS, please read the [[Subversion]] page.
 
  
=== Setting up a Build Environment ===
+
<small>* Perhaps, some functions of RosBE may not work on ReactOS. If so, please have a look on our [http://jira.reactos.org/ Jira] page whether this problem is already reported or not.</small>
  
For building ReactOS you also need the official [[ReactOS Build Environment]]. Please download and install it from that page.
+
=== Building ReactOS on Unix/Linux ===
 +
<code>
 +
ninja COMMANDS
 +
</code>
 +
Combining the above steps together:
 +
Replace "COMMANDS" with the desired build commands, such as <code>bootcd</code> or <code>livecd</code>, listed below:
  
 
== Commands ==
 
== Commands ==
Line 20: Line 81:
 
=== Invoking a build ===
 
=== Invoking a build ===
  
'''make'''
+
<code>'''ninja'''</code> or <code>'''ninja all'''</code>
This command builds all binaries of ReactOS. They will be placed in the directory specified by the ROS_OUTPUT environment variable. (default: ''output-i386'')
+
 
 +
This command builds all binaries of ReactOS. They will be placed in the created output directory created by the configure command. (default: ''output-MinGW-i386/reactos'')
 
All source files, which did not change since the last build, will not be built again.
 
All source files, which did not change since the last build, will not be built again.
  
'''make bootcd'''
+
<code>'''ninja bootcd'''</code>
This command works like ''make'', but also generates a bootable ReactOS ISO file (''ReactOS.iso'') in the base of the working copy.
+
 
 +
This command works like ''make'', but also generates a bootable ReactOS ISO file (''bootcd.iso'') placed into the output directory.
 
It is wise to tag your Boot-CDs with the revision they were built from if you need to keep many ReactOS ISOs.
 
It is wise to tag your Boot-CDs with the revision they were built from if you need to keep many ReactOS ISOs.
  
'''make livecd'''
+
<code>'''ninja livecd'''</code>
This command generates ''ReactOS-LiveCD.iso'' in the base of the working copy. This is the ReactOS Live-CD that runs completely from the CD-ROM
 
 
 
'''make install'''
 
This command copies all the ReactOS binaries to their proper installation directory as specified in the ROS_INSTALL environment variable. (default: ''reactos'')
 
  
'''makex'''
+
This command generates ''livecd.iso'' in the output directory. This is the ReactOS Live-CD that runs completely from the CD-ROM.
Used instead of make will utilize all physical cores on your machine.
 
  
=== Creating [[Wikipedia:Integrated development environment|IDE]] project files ===
+
<code>'''ninja hybridcd'''</code>
  
* <code>make msvc8</code> - Create project files for Visual C++ 2005 (8.0)
+
This command generates ''hybridcd.iso'' in the output directotry. This is a hybrid cd of ReactOS
* <code>make msvc9</code> - Create project files for Visual C++ 2008 (9.0)
 
* <code>make msvc10</code> - Create project files for Visual C++ 2010 (10.0)
 
* <code>make cb</code> - Create project files for the [http://www.codeblocks.org Code::Blocks] Multi-Platform IDE.
 
  
 +
<!--
 
=== Other ===
 
=== Other ===
  
 
'''clean'''
 
'''clean'''
This command cleans all files of your working copy except the generated ISO files (if any). The next build you make will be completely clean then. Any parameters will recognized as module name and only this module will be cleaned then.
+
This command cleans all files of your working copy except the generated ISO files (if any). The next build you make will be completely clean then. Any parameters will recognized as module name and only this module will be cleaned then. -->
 
+
<!-- to be continued -->
'''remake'''
 
This tool cleans one or several specific modules and immediately rebuilds it cleanly.
 
 
 
'''make depmap'''
 
This command generates a simple dependency map for all ReactOS components.
 
 
 
'''make vreport'''
 
This command generates a version report for all ReactOS components, whose source files have appropriate information for that.
 
 
 
== Adjusting the Build Configuration ==
 
 
 
In the base of the working copy, you will find a file called ''config.template.rbuild''. This is one of the configuration files for [[RBuild]], our custom build system. Make a copy of this file as ''config.rbuild'' and open it in an editor.  Each option is commented with a short description of what it does. Adjust the file to your needs and save it.
 
Additionally RosBE has a tool called config, which does all the work for you by asking you for the settings you want and automatically generating the config files.
 
  
 
== Adding modules to the build process ==
 
== Adding modules to the build process ==
Line 69: Line 112:
 
The page [[Building Modules]] describes, which modules exist and how to add them to the build process.
 
The page [[Building Modules]] describes, which modules exist and how to add them to the build process.
  
 +
== See also ==
 +
* '''[http://www.reactos.org/development/build-environment Build Environment] – another tutorial how to build ReactOS '''
 +
* [[Building with MSVC]]
 +
* [[Building MINGW-w64]]
 +
* [http://www.reactos.org/forum/viewtopic.php?f=22&t=11000 Building with Ninja] latest build method, RosBE v2.1
  
 
[[Category:Building]]
 
[[Category:Building]]
 +
[[Category:Tutorial]]

Revision as of 19:17, 18 December 2017

This page describes the steps necessary to build ReactOS.

Getting all you need

Setting up a Build Environment

For building ReactOS you also need the official ReactOS Build Environment. Please download and install it from that page.

Make sure that no interfering build environment (such as MSYS) is in your PATH environment variable when building.

Optional: Set Up Visual Studio

If you want to use Visual Studio to compile ReactOS, you need to get one of the supported version, which is VS2010 and later. You can download the free Community Edition of Visual Studio 2015. To compile with VS, open the appropriate VS command prompt and follow the same instructions as for building with the GCC based ReactOS build environment. Note that you still need the ReactOS build environment, which contains CMake and some additional tools, or you can install the latest version of CMake yourself, but that is not recommended. If you experience problems with the configure stage, e.g. the compiler is reported to not be working, please check if you have installed any additional Windows SDKs or WDK and try again after removing them.

Getting a Working Copy

The first step in building ReactOS is getting a copy of the source code.

You can use the exported release source code, but since you are reading this, you are probably interested in keeping up to date with the latest changes, so you will want a "working copy" of ReactOS. To get a working copy of ReactOS, please read the ReactOS Git For Dummies page.

You need to have Git installed on your system. The command

git clone https://github.com/reactos/reactos.git 

from within the command prompt will download it.

Prerequisites

Imbox notice.png

Notice: It is recommended to temporarily disable your antivirus before proceeding, because some of them detect some of ReactOS' system files (in particular, crtdll.dll) as being infected.

Before building either the tools or ReactOS itself the output location must be created and prepared. This is an easy step and involves only one command. This command is located in the root of recent revisions of the source code and can be run either from the root directory itself or any other directory you want the build your sources in. Please make sure you are running it from within ReactOS BE:

Linux/Unix

Run:

 configure.sh
 cd output-MinGW-i386/reactos

Windows or ReactOS

Run:

 configure.cmd
 cd output-MinGW-i386

After executing, folder output-MinGW-i386 will be created in root of ReactOS tree. You will be redirected to it. If you want to build in a different folder, cd to that folder first and then execute

<path_to_source>\configure.cmd

configure.cmd currently supports the following options:

  • /? displays help
  • Codeblocks creates a CodeBlocks solution
  • Eclipse creates an Eclipse solution
  • Makefiles creates (n)make files
  • clang Uses clang instead of gcc
  • VSSolution Creates a Visual Studio solution
  • RTC enables extra runtime checks

You can additionally specify any number of cmake command line options, like "-DSYMBOL=VALUE".

Building ReactOS on Windows or ReactOS*

From the build folder (e.g. reactos\output-MinGW-i386) enter the following command:

ninja COMMANDS

Replace "COMMANDS" with the desired build commands, such as bootcd or livecd, listed below:

* Perhaps, some functions of RosBE may not work on ReactOS. If so, please have a look on our Jira page whether this problem is already reported or not.

Building ReactOS on Unix/Linux

ninja COMMANDS

Combining the above steps together: Replace "COMMANDS" with the desired build commands, such as bootcd or livecd, listed below:

Commands

After you have started a Build Environment Command Prompt, there are certain commands available.

Invoking a build

ninja or ninja all

This command builds all binaries of ReactOS. They will be placed in the created output directory created by the configure command. (default: output-MinGW-i386/reactos) All source files, which did not change since the last build, will not be built again.

ninja bootcd

This command works like make, but also generates a bootable ReactOS ISO file (bootcd.iso) placed into the output directory. It is wise to tag your Boot-CDs with the revision they were built from if you need to keep many ReactOS ISOs.

ninja livecd

This command generates livecd.iso in the output directory. This is the ReactOS Live-CD that runs completely from the CD-ROM.

ninja hybridcd

This command generates hybridcd.iso in the output directotry. This is a hybrid cd of ReactOS


Adding modules to the build process

There are several modules you can add to the build process. For example rosapps contains some additional applications not included by default.

The page Building Modules describes, which modules exist and how to add them to the build process.

See also