• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Installing the Compilation Tools
2
3
4For details about the functions of the OpenHarmony compilation and building module, see [Compilation and Building Guide](../subsystems/subsys-build-all.md).
5
6Perform the following steps on Ubuntu.
7
8
9## hb Installation
10
11> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
12>
13> For details about how to install the proxy, see [Configuring the Proxy](quickstart-pkg-common-proxy.md).
14
151. Run the following command to install hb and update it to the latest version:
16
17   ```
18   pip3 install --user build/lite
19   ```
20
212. Set an environment variable.
22
23   ```
24   vim ~/.bashrc
25   ```
26
27     Copy the following command to the last line of the .bashrc file, save the file, and exit.
28
29   ```
30   export PATH=~/.local/bin:$PATH
31   ```
32
33     Update the environment variable.
34
35   ```
36   source ~/.bashrc
37   ```
38
393. Run the **hb -h** command in the source code directory. If the following information is displayed, the installation is successful:
40
41   ```
42   usage: hb
43
44   OHOS build system
45
46   positional arguments:
47     {build,set,env,clean}
48       build               Build source code
49       set                 OHOS build settings
50       env                 Show OHOS build env
51       clean               Clean output
52
53   optional arguments:
54     -h, --help            show this help message and exit
55   ```
56
57> ![icon-notice.gif](public_sys-resources/icon-notice.gif) **NOTICE**
58> - To uninstall hb, run the following command:
59>
60>   ```
61>   pip3 uninstall ohos-build
62>   ```
63>
64> - If any issue occurs during the hb installation, see [FAQs](quickstart-pkg-common-hberr.md).
65
66
67## Installing LLVM (Only Required for OpenHarmony_v1.x)
68
69> ![icon-notice.gif](public_sys-resources/icon-notice.gif) **NOTICE**
70>
71> When downloading source code under the OpenHarmony_v1.x branches or tags, perform the procedure described in this section to install LLVM 9.0.0.
72>
73> When downloading source code under the Master or non-OpenHarmony_v1.x branches or tags, skip this section. hb will automatically download the latest version of LLVM.
74
751. Start the Linux server.
76
772. [Download LLVM](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar).
78
793. Decompress the LLVM installation package to **~/llvm**.
80
81   ```
82   tar -zxvf llvm.tar -C ~/
83   ```
84
854. Set an environment variable.
86
87   ```
88   vim ~/.bashrc
89   ```
90
91   Copy the following command to the last line of the .bashrc file, save the file, and exit.
92
93
94   ```
95   export PATH=~/llvm/bin:$PATH
96   ```
97
985. Validate the environment variable.
99
100   ```
101   source ~/.bashrc
102   ```
103