Difference between revisions of "A Layman's Guide - How to Compile ReactOS"

From ReactOS Wiki
Jump to: navigation, search
m (Make a link work)
m (Configuring and installing RosBE)
(17 intermediate revisions by the same user not shown)
Line 48: Line 48:
 
'''Note''': if want to have a script do most of the above work for you, then there is a  '''[[User:Oldman/A layman's guide/Miscellaneous#Windows - Create the Tutorial working environment|script here]]''' to do just that. <!--[[#Windows - Create the Tutorial working environment]]-->
 
'''Note''': if want to have a script do most of the above work for you, then there is a  '''[[User:Oldman/A layman's guide/Miscellaneous#Windows - Create the Tutorial working environment|script here]]''' to do just that. <!--[[#Windows - Create the Tutorial working environment]]-->
  
===Compiling the source===
+
===Compiling the source (32 bit)===
  
 
To continue with my example; start RosBE, and from it's command prompt: <sup>[<span style="color:#0000ff">'''8'''</span>]</sup> ('''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,
 
To continue with my example; start RosBE, and from it's command prompt: <sup>[<span style="color:#0000ff">'''8'''</span>]</sup> ('''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,
Line 73: Line 73:
 
If you have problems compiling after you have updated your local source tree, try typing '''ninja clean''' and then start again at step '''1''' above.
 
If you have problems compiling after you have updated your local source tree, try typing '''ninja clean''' and then start again at step '''1''' above.
  
 +
===Compiling the source (64 bit)===
  
===Compiling - Screenshots===
+
'''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'''.
 +
* '''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:
 +
 
 +
<span style="color:#006080;">'''E:\ReactOS_Development\compiled64></span>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====
 
====Getting the source with Git====
Line 115: Line 130:
  
 
<gallery widths="503px" heights="386px" paddings="0px">
 
<gallery widths="503px" heights="386px" paddings="0px">
File:rosbe-3.png|[<span style="color:#0000ff">'''7'''</span>] Choosing a Desktop icon.
+
File:rosbe-3.png|[<span style="color:#0000ff">'''7'''</span>] Choosing a Desktop shortcut.
 
</gallery>
 
</gallery>
 +
'''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====
+
====Compiling with RosBE====
  
 
<gallery widths="715px" heights="546px" paddings="0px">
 
<gallery widths="715px" heights="546px" paddings="0px">
Line 125: Line 141:
 
In the screenshot of RosBE, you can see that the working directory as been changed from '''source''' to '''compiled''', then '''configure ninja''' as been executed and completed. The command line now shows '''ninja bootcd''' waiting to be executed.
 
In the screenshot of RosBE, you can see that the working directory as been changed from '''source''' to '''compiled''', then '''configure ninja''' as 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====
 +
<gallery widths="677px" heights="510px" paddings="0px">
 +
File:Rosbe-2.2.0.png
 +
</gallery>
 +
Note: If you change from 32 bit compile mode to amd64 mode, it will still have green text.
 +
 +
===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 '''D:\ReactOS_Development>''' and type the following:
 +
 +
<span style="font:large normal monospace">'''git clone --single-branch --branch releases/0.4.13  <nowiki>https://github.com/reactos/reactos.git</nowiki> 0.4.13'''<span>
 +
 +
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.
 +
 +
'''<nowiki>https://github.com/reactos/reactos.git</nowiki>''' ..... 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.
 +
 +
<span style="font:large bold monospace">git clone --single-branch --branch releases/0.4.13  <nowiki>https://github.com/reactos/reactos.git</nowiki> '''mybranch'''</span>
 +
 +
=====Selecting a branch=====
 +
<gallery widths="882px" heights="497px" paddings="0px">
 +
File:Reactos.git.png
 +
</gallery>
 +
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.
  
 
===<span style="color:#0000ff">How to compile ReactOS - '''Unix subsection'''</span>===
 
===<span style="color:#0000ff">How to compile ReactOS - '''Unix subsection'''</span>===
Line 142: Line 202:
 
* '''zlib'''
 
* '''zlib'''
  
There is a script in the unix section of '''[[Miscellaneous#Software_checker-installer_for_RosBE |Miscellaneous]]''', which can automate the checking for and installation of the above software. <!-- [[#Software_checker-installer_for_RosBE |Miscellaneous]]  -->
+
There is a script in the unix section of '''[[User:Oldman/A layman's guide/Miscellaneous#Software_checker-installer_for_RosBE |Miscellaneous]]''', which can automate the checking for and installation of the above software. <!-- [[#Software_checker-installer_for_RosBE |Miscellaneous]]  -->
  
 
===Setting up a local working environment===
 
===Setting up a local working environment===
Line 168: Line 228:
 
I created the shortcut in '''/home''' then copied it onto the desktop and checked to see if it ran RosBE.
 
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 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 <nowiki>https://github.com/reactos/reactos.git</nowiki>'''.  
 +
 
 +
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'''.
 
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'''.
Line 174: Line 238:
 
The alternative to the 'Right click-Window-Terminal Here' method, is to type the full address, eg. '''/home/RosBuild/source'''.
 
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'''
+
To update the source code, right click within the reactos folder and select '''Window''' - '''Terminal Here''', then at the command prompt type:  
 +
 
 +
'''git pull <nowiki>https://github.com/reactos/reactos.git</nowiki>'''
  
 
'''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.
 
'''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.
  
There is also a script in the '''[[Miscellaneous#Create the Tutorial working environment|Miscellaneous]]''' unix section, that can automate the setting up of a working environment.
+
There is also a script in the '''[[User:Oldman/A layman's guide/Miscellaneous#Create the Tutorial working environment|Miscellaneous]]''' unix section, that can automate the setting up of a working environment.
 
  <!-- [[#Create the Tutorial working environment|Miscellaneous]]  -->
 
  <!-- [[#Create the Tutorial working environment|Miscellaneous]]  -->
 +
 
===Compiling the source===
 
===Compiling the source===
  

Revision as of 11:52, 2 May 2020

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. The main section covers Windows and the subsection covers unix.

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), for 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\ create 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.

Note: if want to have a script do most of the above work for you, then there is a script here to do just that.

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 ninja

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 have problems compiling after you have updated your local source tree, try typing ninja clean and then start again at step 1 above.

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.
  • 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.

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 as been changed from source to compiled, then configure ninja as 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 mode, it will still have green text.

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 D:\ReactOS_Development> 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.

How to compile ReactOS - Unix subsection

The ReactOS Build Environment requires the following software to be installed on Unix systems:

  • as
  • bison
  • curl
  • flex
  • gcc
  • git
  • g++
  • make
  • makeinfo
  • pkg-config
  • python
  • zlib

There is a script in the unix section of Miscellaneous, which can automate the checking for and installation of the above software.

Setting up a local working environment

You will now need to download the ReactOS Build Environment (RosBE), from https://www.reactos.org/wiki/ReactOS_Build_Environment

Example:

Unpack the RosBE installation files to /home/RosBE-Unix-2.1.2 directory.

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-2.1.2 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.

There is also a script in the Miscellaneous unix section, that can automate the setting up of a working environment.

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, type cd /home/RosBuild/compiled/reactos/

and then ninja livecd or ninja bootcd

Screenshots


Layman's guides