A layman's guide - How to compile ReactOS
This guide shows you how to make your own working environment, down load the ReactOS source code and then compile it using the Reactos Build Evironment. Section one covers Windows and section two covers Unix and section three applies to either.
Contents
Section one - Windows
Setting up a local working environment
You will need to install git for Windows from https://git-for-windows.github.io/ and TortoiseGit from https://tortoisegit.org/.
Next you will need to create a master folder to keep all the next folders in one place. This folder can be created in C: or D: (or any other drive partition and name it whatever you want), example D:\ReactOS_Development or C:\ROS.
Create the following folders in your master folder:
1. \source (the name does not matter - you will download the source tree into this folder).
2. \compiled (the name does not matter - this is the output folder where the binaries are complied to and the ISO is created).
3. \RosBE (this is where you will install RosBE).
You should now have something like the following examples.
Example No1
C:\ROS\source
C:\ROS\compiled
C:\ROS\RosBE
or
Example No2
D:\ReactOS_Development\Source
D:\ReactOS_Development\Compiled
D:\ReactOS_Development\RosBE
Using example No2, within D:\ReactOS_Development\ you will have created a Compiled folder, a RosBE folder and a Source folder. Next, navigate into D:\ReactOS_Development\Source and right click within the folder, then select Git Clone, then in the next window, enter this url https://github.com/reactos/reactos.git; this will create a reactos folder and download the current source tree into it.
I have noticed this behaviour with Git; if you first copy the url, then click in the source folder, you will find that Git has put the copied url in the Url input and put the path to your source folder with the addition of reactos, in the Directory input. See [1] [2] [3a] [3b] [4] in the Getting the source with Git section below.
For how to update your local source, see the subsection Updating a local source tree with Git.
Having downloaded the source you will now need to download and install the ReactOS Build Environment [5] [6] [7] (a link to the latest version (Windows and Unix) can be found here: https://www.reactos.org/wiki/ReactOS_Build_Environment) into D:\ReactOS_Development\RosBE.
If you have git, TortoiseGit, RosBE installed, and ReactOS master cloned into your source directory, you are ready to start the compilation process.
Compiling the source (32 bit)
To continue with my example; start RosBE, and from it's command prompt: [8] (Note: If you did not install RosBE with the desktop shortcut option selected, then open a command prompt window and navigate to D:\ReactOS_Development\RosBE and type RosBE to start it.) and within RosBE,
1. Navigate to D:\ReactOS_Development\Compiled and type D:\ReactOS_Development\Source\reactos\configure
1a. Still within D:\ReactOS_Development\Compiled type ninja clean (also do this if you have previously compiled).
2. Still within D:\ReactOS_Development\Compiled type ninja bootcd
or
3. Still within D:\ReactOS_Development\Compiled type ninja livecd
or
4. Still within D:\ReactOS_Development\Compiled type ninja hybridcd
or if want all three ISO images
5. Still within D:\ReactOS_Development\Compiled type ninja bootcd livecd hybridcd
Now you should find the bootcd and/or the livecd and/or hybridcd in D:\ReactOS_Development\Compiled\reactos.
If you are doing something different to the suggested example above and have not created a separate directory for the compiled source, then when using RosBE and you are in the reactos directory and have typed configure, you will find that RosBE has created a new directory in the reactos directory, called output-MinGW-i386. You must change directories into this output-MinGW-i386 directory to issue the commands ninja livecd or ninja bootcd (make bootcd or make livecd). The created ISO will then be in the output-MinGW-i386 directory.
What ever directory structure you have created, you will need to be in the directory that RosBE declares after it has run the configure command.
This is one example (below) from RosBE output, where I have underlined the path in white. Whatever the path that is shown there, is the directory that you should be in, to build and make the ISO of your choice.
-- Generating done
-- Build files have been written to: E:/ReactOS_Development/Compiled
Configure script complete! Execute appropriate build commands (ex: ninja, make, nmake, etc...)
Compiling the source (64 bit)
Note:
- These instructions are only applicable to RosBE 2.2.0 and above.
- They do not work with the earlier RosBE 2.1.6.
- 64 bit gcc is not currently supported (this may change soon).
- RosBE needs to be configured to use msvc to compile a 64 bit version of ReactOS.
You are advised to have a different compiled directory folder from the 32 bit, to separate the different codes.
The compile instructions are the same as for the 32 bit above. All that you have to do, is to change to 64 bit mode with the command charch amd64 like so:
E:\ReactOS_Development\compiled64>charch amd64
To change back to the 32 bit mode, use the same command charch, with i386 in place of amd64 and do not forget to change to your 32 bit directory folder.
Screenshots
Getting the source with Git
The following window will then open.
[2] If the URL is correct (https://github.com/reactos/reactos.git) and the Directory (for the source) is correct, then the rest can be left as they are. Click on the OK button to start the download process.
Updating a local source tree with Git
Configuring and installing RosBE
Note: If you select AMD64 compiler and Desktop shortcuts, you will have two RosBE shortcuts on the desktop, one for the 32 bit compiler and one for the AMD64 compiler.
Compiling with RosBE
In the screenshot of RosBE, you can see that the working directory has been changed from source to compiled, then configure ninja has been executed and completed. The command line now shows ninja bootcd waiting to be executed.
Note: RosBE 2.2.0 amd64 displays with blue text and the for 32 bit compile mode, with green text, as above.
Changing modes in RosBE
Note: If you change from 32 bit compile mode to amd64, it will still have green text.
Section two - Unix
The ReactOS Build Environment requires the following software to be installed on Unix systems:
- as
- bison
- curl
- flex
- gcc
- git
- g++
- m2
- make
- makeinfo
- pkg-config
- python
- zlib
Setting up a local working environment
You will now need to download the current ReactOS Build Environment (RosBE), from https://www.reactos.org/wiki/ReactOS_Build_Environment
Example:
Unpack the RosBE installation files to /home/RosBE-Unix-*.*.* directory.
(*.*.* = version number, currently 2.2.1)
Create the following folders /home/RosBuild then /home/RosBuild/RosBE (install RosBE in this folder).
Note: The default directory for RosBE, is /usr/local/RosBE, if you prefer, you can use that.
To continue with my example; Open the folder /home/RosBE-Unix-*.*.* and right click within [9], for the menu, Window - Terminal Here [10].
In the terminal window, run the builder script by typing ./RosBE-Builder.sh. If it reports any missing tools [11], you will need to install them (see list above).
Then run the script as before, and if it reports all tools OK [12], then you can continue.
To follow my example, type /home/RosBuild/RosBE for the install directory and then follow the instructions from the running script.
If all went well, then it will ask you about creating a shortcut, just follow the instructions.
I created the shortcut in /home then copied it onto the desktop and checked to see if it ran RosBE.
To populate your source folder, you will need to open a terminal window within the empty source folder; right click - Window - Terminal Here, then at the command prompt, type:
git clone https://github.com/reactos/reactos.git.
This will create a folder called reactos and download the main source code.
To get the revision number, right click on the reactos folder and select Window - Terminal Here, then at the command prompt, type: git describe, which will display something like this 0.4.7-dev-532-g3cd76b91b5.
The alternative to the 'Right click-Window-Terminal Here' method, is to type the full address, eg. /home/RosBuild/source.
To update the source code, right click within the reactos folder and select Window - Terminal Here, then at the command prompt type:
git pull https://github.com/reactos/reactos.git
NOTE: You must be actually in the source folder to clone and actually in the reactos folder to update the source or get the revision number.
Compiling the source
Start RosBE and at the terminal command prompt type cd /home/RosBuild/compiled (or the directory that you want ReactOS to be built into).
Then type /home/RosBuild/source/reactos/configure.sh.
When the script finishes, still within /home/RosBuild/compiled/reactos/ type ninja livecd or ninja bootcd
If you are doing something different to the suggested example above and have not created a separate directory for the compiled source, then when using RosBE and you are in the reactos directory and have typed configure.sh, you will find that RosBE has created a new directory in the reactos directory, called output-MinGW-i386. You must change directories into this output-MinGW-i386 directory to issue the commands ninja livecd or ninja bootcd (make does not work in Unix RosBE). The created ISO will then be in the output-MinGW-i386 directory.
What ever directory structure you have created, you will need to be in the directory that RosBE declares after it has run the command configure.sh from within the reactos directory.
This is one example (below) from RosBE output, where I have underlined the path in green. Whatever the path that is shown there, is the directory that you should be in, to build and make the ISO of your choice.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/oldman/ROSBuild/Compiled32
Configure script complete! Execute appropriate build commands (ex: ninja, make, nmake, etc...).
Screenshots
Section three - General
Getting the source of a single branch
You may decide you want to download the source of one of the branches, so this is how to do it from the command prompt using the directory structure from the previous examples.
In a terminal widow, navigate to your local source directory and type the following:
git clone --single-branch --branch releases/0.4.13 https://github.com/reactos/reactos.git 0.4.13
Replace releases/0.4.13 with the branch of your choice.
Explanation:
git ..................................................................... Starts git.
clone ............................................................... The command that tells git to clone the Repository.
--single-branch .............................................. This tells git to only clone a single branch.
--branch .......................................................... The switch for a branch.
releases/0.4.13 .............................................. The branch path and name.
https://github.com/reactos/reactos.git ....... The URL of the Reactos git repository.
0.4.13 ............................................................... The folder to clone into.
If you omit to put a folder name after the URL, it will use the default from github, which will be reactos. You could use any name you choose, as in the following example, where mybranch is used; if the folder does not exist, then it will be created.
git clone --single-branch --branch releases/0.4.13 https://github.com/reactos/reactos.git mybranch
Selecting a branch
In your browser, go to https://github.com/reactos/reactos, which will display the page shown in the image above.
To select a branch, click on the down arrow (as shown in the above image), then choose a branch from the drop-down list; you may need to scroll down the list.
Getting the source from a repository
If you want to clone an individual repository from https://github.com/reactos
for example rapps-db, then add the repository name to the end of the url, like so:
git clone https://github.com/reactos/rapps-db
or developer-web-interface, then it would look like this:
git clone https://github.com/reactos/developer-web-interface
Using the example of rapps-db, if you wanted to clone it into another directory other than rapps-db, then you would leave a space at the end of the url and then type the chosen name for the directory, like so:
git clone https://github.com/reactos/rapps-db software_database (software_database is only a suggestion, use your own name).