harmony 鸿蒙Installing the Compilation Tools

  • 2022-12-05
  • 浏览 (503)

Installing the Compilation Tools

For details about the functions of the OpenHarmony compilation and building module, see Compilation and Building Guide.

Perform the following steps on Ubuntu.

hb Installation

icon-note.gif NOTE

For details about how to install the proxy, see Configuring the Proxy.

  1. Run the following command to install hb and update it to the latest version:
   python3 -m pip install --user build/hb
  1. Set an environment variable.
   vim ~/.bashrc
 Copy the following command to the last line of the .bashrc file, save the file, and exit.
   export PATH=~/.local/bin:$PATH
 Update the environment variable.
   source ~/.bashrc
  1. Run the hb help command in the source code directory. If the following information is displayed, the installation is successful:

hb_help

icon-notice.gif NOTICE - To uninstall hb, run the following command:

>   python3 -m pip uninstall ohos-build   
>   ```
> 
> - If any issue occurs during the hb installation, see [FAQs](quickstart-pkg-common-hberr.md).


## Installing LLVM (Only Required for OpenHarmony_v1.x)

> ![icon-notice.gif](http://qiniu.seaxiang.com//1660031962-bu6k1Ayt.gif) **NOTICE**
>
> 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.
>
> 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.

1. Start the Linux server.

2. [Download LLVM](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar).

3. Decompress the LLVM installation package to **~/llvm**.
     
   ```shell
   tar -zxvf llvm.tar -C ~/
  1. Set an environment variable.
   vim ~/.bashrc

Copy the following command to the last line of the .bashrc file, save the file, and exit.

   export PATH=~/llvm/bin:$PATH
  1. Validate the environment variable.
   source ~/.bashrc

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Getting Started

harmony 鸿蒙Build Form Factors

harmony 鸿蒙Getting Started with the Standard System with Hi3516 (IDE Mode)

harmony 鸿蒙Getting Started with the Standard System with Hi3516 (CLI Mode)

harmony 鸿蒙Hi3516 Development Board

harmony 鸿蒙Hi3861 Development Board

harmony 鸿蒙RK3568 Development Board

harmony 鸿蒙Building Source Code

harmony 鸿蒙Burning an Image

harmony 鸿蒙Writing a Hello World Program

0  赞