From 1c54fcedbbcceb7fad7270f46d5d9144ecbf431e Mon Sep 17 00:00:00 2001 From: Lyupa Anastasia Date: Mon, 5 Feb 2024 14:01:20 +0300 Subject: [PATCH] [Build] Add clang, lld for aarch64, copy runtimes Enable clang, lld, clang-tools-extra projects in build script. Copy runtimes from main toolchain build to ohos-aarch64-install. Issue: https://gitee.com/openharmony/third_party_llvm-project/issues/I9083P Signed-off-by: Lyupa Anastasia --- llvm-build/README.md | 4 ++-- llvm-build/build-ohos-aarch64.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/llvm-build/README.md b/llvm-build/README.md index 1a256676fd34..c04c18af0012 100644 --- a/llvm-build/README.md +++ b/llvm-build/README.md @@ -114,7 +114,7 @@ OHOS fetch prebuilts from: https://mirrors.huaweicloud.com/openharmony/compiler/ License: Apache License v2.0 with LLVM Exceptions ``` -### Build process of AArch64 LLVM components for Ark Runtime +### Build process of AArch64 toolchain First build toolchain on Linux. Here is an example of starting build process on Linux: @@ -134,7 +134,7 @@ build-ohos-aarch64.py options: ```
-When build successfully completed, artifacts will be available in `out/ohos-aarch64-install` directory, including LLVM tools and libLLVM.so for aarch64. +When build successfully completed, artifacts will be available in `out/ohos-aarch64-install` directory, including clang, lld, runtimes, LLVM tools and libLLVM.so for aarch64. ## Function Introduction diff --git a/llvm-build/build-ohos-aarch64.py b/llvm-build/build-ohos-aarch64.py index f197e3ea75cb..35bceab1a12b 100644 --- a/llvm-build/build-ohos-aarch64.py +++ b/llvm-build/build-ohos-aarch64.py @@ -64,7 +64,7 @@ def main(): llvm_defines['LLVM_INCLUDE_TESTS'] = 'OFF' llvm_defines['LLVM_BUILD_TOOLS'] = 'ON' llvm_defines['LLVM_ENABLE_ZLIB'] = 'OFF' - llvm_defines['LLVM_DISTRIBUTION_COMPONENTS'] = 'cmake-exports;llvm-headers;LLVM' + llvm_defines['LLVM_ENABLE_PROJECTS'] = 'clang;lld;clang-tools-extra' llvm_defines['LLVM_CONFIG_PATH'] = os.path.join(llvm_root, 'bin', 'llvm-config') llvm_defines['LLVM_TABLEGEN'] = os.path.join(llvm_root, 'bin', 'llvm-tblgen') llvm_defines['CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN'] = llvm_root @@ -111,6 +111,11 @@ def main(): build_utils.invoke_ninja(out_path=llvm_path, env=env, target=None, install=True) + # Copy required aarch64-linux-ohos libs from main toolchain build. + build_utils.check_copy_tree(os.path.join(llvm_root, 'lib', llvm_triple), + os.path.join(llvm_install, 'lib', llvm_triple)) + build_utils.check_copy_tree(os.path.join(llvm_root, 'lib', 'clang', '15.0.4', 'lib', llvm_triple), + os.path.join(llvm_install, 'lib', 'clang', '15.0.4', 'lib', llvm_triple)) if __name__ == '__main__': main() -- Gitee