• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# sysroot<a name="EN-US_TOPIC_0000001096759155"></a>
2
3-   [Introduction](#section11660541593)
4-   [Directory Structure](#section161941989596)
5-   [Constraints](#section119744591305)
6-   [Compilation and Building](#section137768191623)
7-   [Usage](#section68313135353)
8-   [Repositories Involved](#section1371113476307)
9
10## Introduction<a name="section11660541593"></a>
11
12**sysroot**  is a root directory used by the Clang compiler to search for standard libraries and header files. The libc library is generated from the open-source musl library by compilation.
13
14## Directory Structure<a name="section161941989596"></a>
15
16```
17/prebuilts/lite/sysroot
18├── build                   # Toolchain building (including build scripts)
19├── usr                     # C library and header files exposed externally
20│   ├── include             # Header files exposed externally
21│   │  └── arm-liteos       # Chip architecture for the toolchain
22│   └── lib                 # C library exposed externally
23│       └── arm-liteos      # Chip architecture for the toolchain
24```
25
26## Constraints<a name="section119744591305"></a>
27
28**sysroot**  applies only to the OpenHarmony kernel.
29
30## Compilation and Building<a name="section137768191623"></a>
31
32When bugs in the musl library are fixed or the version is updated, you need to compile and build a new libc library by executing `make`  in the  **build**  directory, respectively. The new libc library will be stored in the  **/prebuilts/lite/sysroot/usr**  directory.
33
34## Usage<a name="section68313135353"></a>
35
36-   Add the bin directory to the PATH environment variable. For details about how to set up the compilation environment, see  [Quick start](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/Readme-EN.md).
37-   The following is a sample script for compiling the  **helloworld.c**  program:
38
39```
40clang -o helloworld helloworld.c -target arm-liteos --sysroot=/my_ohos_root_path/prebuilts/lite/sysroot/
41```
42
43## Repositories Involved<a name="section1371113476307"></a>
44
45[Kernel subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/kernel.md)
46
47**prebuilts\_lite\_sysroot**
48
49