diff --git a/README-zh.md b/README-zh.md index a71d0fa4552cf15db01337fecd5b2b782f6f7613..d388a8014badddf7207b1a76958fbd2e1cb83453 100644 --- a/README-zh.md +++ b/README-zh.md @@ -35,6 +35,12 @@ python3-setuptools python-wheel texinfo binutils-devel libatomic ./build.sh -C -r -b release -X X86 -j 8 // 添加了-C选项 ``` +为解决其他操作系统下(CentOS等)的glibc兼容性问题,openEuler LLVM项目同时提供可选的CentOS构建镜像(当前仅支持AArch64架构),开发者可以通过`build.sh`脚本的`-D`选项切换使用的构建容器,例如: + +``` +./build.sh -C -D CentOS -r -b release -X AArch64 -j 8 // 添加了-D CentOS +``` + 相关依赖: * 开发环境需要正确安装了docker应用。 * 用户加入了docker用户组,使得`build.sh`脚本执行docker命令时不需要再加`sudo`命令。可以通过如下命令将当前用户加入docker用户组。 diff --git a/README.md b/README.md index 8665dede3cda91dccad7e4e1c1353d604d827f1e..c1452b0202eb647cd0cadb7ccb29f8d314e6c65d 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,12 @@ The openEuler LLVM project provides a containerized building mode to solve the p ./build.sh -C -r -b release -X X86 -j 8 // added -C option ` ` ` +To address glibc compatibility issues on other operating systems (such as CentOS), the openEuler LLVM project also provides an optional CentOS build image (currently only supporting the AArch64 architecture). Developers can switch the build container using the -D option in the build.sh script. For example: + +` ` ` +./build.sh -C -D CentOS -r -b release -X AArch64 -j 8 // added -D CentOS option +` ` ` + Dependency: * The Docker application must be correctly installed in the development environment. * The user is added to the docker user group so that the `sudo` command is not required when the `build.sh` script executes the docker command. You can run the following command to add the current user to the docker user group: diff --git a/build.sh b/build.sh index 5b50e6b8288ab24ef7083e80ebf355f0247cb7ea..605ae191463c0a7755c1ea3ce369a6fcccf67016 100755 --- a/build.sh +++ b/build.sh @@ -29,7 +29,8 @@ build_dir_name="build" install_dir_name="install" build_prefix="$dir/$build_dir_name" install_prefix="$dir/$install_dir_name" -container="openEuler" +container=openEuler +containerize_needed=0 # Use 8 threads for builds and tests by default. Use more threads if possible, # but avoid overloading the system by using up to 50% of available cores. @@ -57,7 +58,8 @@ Options: -A Disable ACPO. -b type Specify CMake build type (default: $buildtype). -c Use ccache (default: $use_ccache). - -C env Containerize the build for openEuler/CentOS compatibility (default: $container). + -C Containerize the build for compatibility. + -D env Use openEuler/CentOS docker container for containerize build (default: $container). -e Build for embedded cross tool chain. -E Build for openEuler. -h Display this help message. @@ -78,7 +80,7 @@ EOF # Process command-line options. Remember the options for passing to the # containerized build script. containerized_opts=() -while getopts :aAb:d:cC::eEhiI:j:orstvfX: optchr; do +while getopts :aAb:cCd:D:eEhiI:j:orstvfX: optchr; do case "$optchr" in a) enable_autotuner="0" @@ -108,19 +110,10 @@ while getopts :aAb:d:cC::eEhiI:j:orstvfX: optchr; do containerized_opts+=(-$optchr) ;; C) - container="$OPTARG" if [ -z "$docker" -o ! -x "$docker" ]; then echo "$0: no usable Docker" exit 1 fi - case "${container,,}" in - openEuler|CentOS) - ;; - *) - echo "$0: invalid container env '$container'" - exit 1 - ;; - esac containerize=1 ;; d) @@ -128,6 +121,24 @@ while getopts :aAb:d:cC::eEhiI:j:orstvfX: optchr; do build_prefix="$dir/$build_dir_name" containerized_opts+=(-$optchr "$OPTARG") ;; + D) + container="$OPTARG" + containerize_needed=1 + case "${container}" in + openEuler) + ;; + CentOS) + if [ "$(uname -m)" != "aarch64" ]; then + echo "$0: CentOS container only support AArch64 for now" + exit 1 + fi + ;; + *) + echo "$0: invalid container env '$container'" + exit 1 + ;; + esac + ;; f) enable_classic_flang="1" containerized_opts+=(-$optchr) @@ -229,6 +240,10 @@ if [ $containerize -eq 0 ]; then trap 'handle_abort 129 HUP' SIGHUP trap 'handle_abort 130 INT' SIGINT trap 'handle_abort 143 TERM' SIGTERM + if [ $containerize_needed -eq 1 ]; then + echo "$0: -C is needed for containerize build" + exit 1 + fi else cmd=$(readlink --canonicalize-existing $0)