Haryslee 7cf21be11c fix: add macro to control the build of sysroot
close #I53VW6

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I45d625e74e7d7d70f3ceaf1ca12eae5fe75b5f35
2022-04-27 17:40:56 +08:00
2021-12-24 15:50:37 +08:00
2020-09-09 16:07:17 +08:00
2021-03-11 18:44:10 +08:00
2022-03-14 08:08:10 +00:00
2022-03-14 08:08:10 +00:00

sysroot

Introduction

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.

Directory Structure

/prebuilts/lite/sysroot
├── build                   # Toolchain building (including build scripts)
├── usr                     # C library and header files exposed externally
│   ├── include             # Header files exposed externally
│   │  └── arm-liteos       # Chip architecture for the toolchain
│   └── lib                 # C library exposed externally
│       └── arm-liteos      # Chip architecture for the toolchain

Constraints

sysroot applies only to the OpenHarmony kernel.

Compilation and Building

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

Usage

  • Add the bin directory to the PATH environment variable. For details about how to set up the compilation environment, see Quick start.
  • The following is a sample script for compiling the helloworld.c program:
clang -o helloworld helloworld.c -target arm-liteos --sysroot=/my_ohos_root_path/prebuilts/lite/sysroot/

Repositories Involved

Kernel subsystem

prebuilts_lite_sysroot

S
Description
System header files and standard libraries | 系统头文件和标准库
Readme 18 MiB
Languages
Makefile 100%