diff --git a/llvm-build/README.md b/llvm-build/README.md index ed9545bcb2512e091aeb90fdc54a24deca7d4292..5f1e0f84c14ce216799028f3bd79957373d16f83 100644 --- a/llvm-build/README.md +++ b/llvm-build/README.md @@ -20,7 +20,7 @@ MacOS X >= 10.15.4 ubuntu ``` -sudo apt-get install build-essential swig python3-dev libedit-dev libncurses5-dev binutils-dev gcc-multilib abigail-tools elfutils pkg-config autoconf autoconf-archive +sudo apt-get install build-essential swig python3-dev libedit-dev libncurses5-dev binutils-dev gcc-multilib abigail-tools elfutils pkg-config autoconf autoconf-archive libxml2 ``` mac ``` @@ -43,188 +43,19 @@ Here is an example of starting build process on Linux or MacOS: ``` # update prebuilts, no need to run each time ./toolchain/llvm-project/llvm-build/env_prepare.sh +#change llvm-project +cd ./toolchain/llvm-project +git remote update +git checkout origin/llvm-18.1.8 # build -python3 ./toolchain/llvm-project/llvm-build/build.py +bash ./toolchain/llvm-project/llvm-build/build.sh ``` -1. env_prepare (one time only) -![输入图片说明](data/one_time_setup.png) - -2. build -![输入图片说明](data/llvm_build.png) - -
- -### Options - -build.py options: - -``` ---skip-build # skip compile and goto package step ---skip-package # do compile without package step ---enable-assertions # enable assertion when compiling ---build-name # specify release package name ---debug # build debug version llvm toolchain ---target-debug # build debug version of target llvm libraries, runtimes, and lldb-server ---strip # strip llvm toolchain binaries ---no-strip-libs # used with -- strip to preserve the symbols of the lib library ---no-build-arm # skip triplet arm ---no-build-aarch64 # skip triplet arm64 ---no-build-x86_64 # skip triplet x86_64 ---no-lto # disable LTO optimization when build toolchain ---build-instrumented # enable instrument pgo when build toolchain ---xunit-xml-output # specify LLVM unit test XML report path ---build-lldb-static # build statically lldb tool for ARM and AARCH64 ---build-python # build python (not using prebuilt one, currently effective for Windows and OHOS) ---build-ncurses # build ncurses tool for linux, Mac x86-64 or M1 ---build-libedit # build libedit tool for linux, Mac x86-64 or M1 ---build-libxml2 # build libxml2 tool for linux, windows, Mac x86_64 or M1 ---lldb-timeout # automatically exit when timeout (currently effective for lldb-server) ---no-build # optional, skip some targets - windows - libs - lldb-server - linux - check-api ---build-clean # delete out folder after build packages ---build_libs_flags # which kind of flags for build_crts and build_runtimes - OH - LLVM - BOTH ---build-only # build only some targets, skip building windows, lldb-server and package step - lld - llvm-readelf - llvm-objdump - musl - compiler-rt - libcxx ---enable-check-abi # Check libc++_shared.so ABI. If the ABI was changed then interrupt a build process and report an error. -``` -
- -### Output Layout - -When build successfully completed. following artifacts will be available in `out` directory - -`sysroot` -> sysroots for OHOS targets -`install` -> toolchain build -`*.tar.bz2` -> archived versions of toolchain and sysroots -
- -### OHOS Archive - -1. llvm -``` -contains: -1. toolchain which provides clang compiler, lldb(-mi), clang-tidy etc. tools -2. libc++/clang_rt/asan/fuzzer libs for target device - -OHOS sync from: https://mirrors.huaweicloud.com/openharmony/compiler/clang/ -Which is the same as: out/clang-dev-${platform}-${arch}.tar.bz2 -OHOS archive to: prebuilts/clang/ohos//${platform}/llvm - -License: Apache License v2.0 with LLVM Exceptions -``` - -2. libcxx-ndk -``` -contains: provide libc++ for ndk in target device - -OHOS fetch prebuilts from: https://mirrors.huaweicloud.com/openharmony/compiler/clang/ and archive it to prebuilts/clang/ohos//${platform}/libcxx-ndk. This tar is - -License: Apache License v2.0 with LLVM Exceptions -``` - -### Build process of AArch64 toolchain - -First build toolchain on Linux. -Here is an example of starting build process on Linux: -``` -# build -python3 ./toolchain/llvm-project/llvm-build/build-ohos-aarch64.py -``` - -
- -build-ohos-aarch64.py options: - -``` ---enable-assertions # enable assertion when compiling ---debug # build debug version llvm toolchain ---strip # strip llvm toolchain binaries ---build-python # build python and enable script in debugger ---build-ncurses # build ncurses and enable ncurses in debugger ---build-libedit # build libedit and enable libedit in debugger ---build-libxml2 # build libxml2 and enable libxml in debugger -``` -
- -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 -
- -### Build process of Arm debugger - -First build toolchain on Linux. -Here is an example of starting build process on Linux: -``` -# build -python3 ./toolchain/llvm-project/llvm-build/build-ohos-arm.py -``` - -
- -build-ohos-arm.py options: - -``` ---build-python # build python and enable script in debugger ---build-ncurses # build ncurses and enable ncurses in debugger ---build-libedit # build libedit and enable libedit in debugger ---build-libxml2 # build libxml2 and enable libxml in debugger -``` -
- -When build successfully completed, artifacts will be available in `out/ohos-arm-install` directory, including lldb for arm. - - -## Function Introduction -
- -### Build process of AArch64 toolchain for Ubuntu (aarch64-linux-gnu triple) - -First build toolchain on Linux. -Install additional package libstdc++-11-dev-arm64-cross. - -Here is an example of starting build process on Linux: -``` -# build -python3 ./toolchain/llvm-project/llvm-build/build-linux-aarch64.py -``` - -
- -build-linux-aarch64.py options: - -``` ---enable-assertions # enable assertion when compiling ---debug # build debug version llvm toolchain ---strip # strip llvm toolchain binaries ---build-python # build python and enable script in debugger ---build-ncurses # build ncurses and enable ncurses in debugger ---build-libedit # build libedit and enable libedit in debugger ---build-libxml2 # build libxml2 and enable libxml in debugger -``` -
- -When build successfully completed, artifacts will be available in `out/linux-aarch64-install` directory, including clang, lld, runtimes, LLVM tools and libLLVM.so for aarch64. -
### Functionality -The LLVM toolchain is built based on LLVM 15.0.4. It is used to provide capability of building ohos image. For detailed information about LLVM 15.0.4, please refer to [LLVM 15.0.4](https://discourse.llvm.org/t/llvm-15-0-4-released/66337). +The LLVM toolchain is built based on LLVM 18.1.8. It is used to provide capability of building ohos image. For detailed information about LLVM 18.1.8, please refer to [LLVM 18.1.8](https://discourse.llvm.org/t/18-1-8-released/79725).
### Specifically Included Triplets