|
| 1 | +# The Arm Toolchain for Linux building script (build.sh) |
| 2 | + |
| 3 | +The aim of the `build.sh` script is to build the ATfL product and package it |
| 4 | +into a tarball. Usually it is being started in a CI environment which is |
| 5 | +responsible for providing all of the necessary building tools and setting |
| 6 | +the environment variables it utilizes. It should be also possible to run |
| 7 | +this script manually and this document should explain how to do that on |
| 8 | +various Linux distribution. |
| 9 | + |
| 10 | +## Preparation of the building environment |
| 11 | + |
| 12 | +### `.deb`-based systems (Debian, Ubuntu) |
| 13 | + |
| 14 | +The following packages need to be installed (using `apt`): |
| 15 | + |
| 16 | +- `binutils-dev` |
| 17 | +- `build-essential` |
| 18 | +- `cmake` |
| 19 | +- `figlet` |
| 20 | +- `git` |
| 21 | +- `libzstd-dev` |
| 22 | +- `ninja-build` |
| 23 | +- `python3` |
| 24 | +- `python3-dev` |
| 25 | +- `python3-myst-parser` |
| 26 | +- `python3-pip` |
| 27 | +- `python3-pygments` |
| 28 | +- `python3-yaml` |
| 29 | +- `zlib1g-dev` |
| 30 | + |
| 31 | +### `.rpm`-based systems (RHEL, CentOS, Alma, Amazon) |
| 32 | + |
| 33 | +- `libgcc` |
| 34 | +- `gcc` |
| 35 | +- `gcc-c++` |
| 36 | +- `diffutils` |
| 37 | +- `patch` |
| 38 | +- `binutils` |
| 39 | +- `binutils-devel` |
| 40 | +- `make` |
| 41 | +- `cmake` |
| 42 | +- `figlet` |
| 43 | +- `git` |
| 44 | +- `ninja-build` |
| 45 | +- `zlib-devel` |
| 46 | +- `zlib-static` |
| 47 | +- `zstd` |
| 48 | +- `wget` |
| 49 | +- `mpfr` |
| 50 | +- `mpfr-devel` |
| 51 | +- `libmpc` |
| 52 | +- `libmpc-devel` |
| 53 | +- `isl` |
| 54 | +- `isl-devel` |
| 55 | +- `cpio` |
| 56 | + |
| 57 | +#### Additionally, on older `.rpm`-based systems (RHEL8, CentOS8): |
| 58 | + |
| 59 | +- `python38` |
| 60 | +- `python38-pip` |
| 61 | +- `python38-yaml` |
| 62 | + |
| 63 | +#### Additionally, on more recent `.rpm`-based systems: |
| 64 | + |
| 65 | +- `python3` |
| 66 | +- `python3-pip` |
| 67 | +- `python3-myst-parser` (since RHEL10) |
| 68 | + |
| 69 | +## Optional: obtaining libamath.a and libamath.so |
| 70 | + |
| 71 | +The Amath library is used by the loop vectorizer to vectorize the loops from |
| 72 | +which math functions are being called. This library is distributed along with |
| 73 | +Arm Performance Libraries. |
| 74 | + |
| 75 | +On the `.deb`-based systems, the easiest way to obtain and extract `libamath.a` |
| 76 | +and `libamath.so` (current latest version, 24.10) is to do the following: |
| 77 | + |
| 78 | +``` |
| 79 | +$ mkdir libamath |
| 80 | +
|
| 81 | +$ cd libamath |
| 82 | +
|
| 83 | +$ wget https://developer.arm.com/-/cdn-downloads/permalink/Arm-Performance-Libraries/Version_24.10/arm-performance-libraries_24.10_deb_flang-new.tar |
| 84 | +
|
| 85 | +$ tar -xf arm-performance-libraries_24.10_deb_flang-new.tar |
| 86 | +
|
| 87 | +$ arm-performance-libraries_24.10_deb/arm-performance-libraries_24.10_deb.sh -a -f -s . |
| 88 | +
|
| 89 | +$ dpkg -x armpl_24.10_flang-new.deb . |
| 90 | +
|
| 91 | +$ cp opt/arm/armpl_24.10_flang-new/lib/libamath.a . |
| 92 | +
|
| 93 | +$ cp opt/arm/armpl_24.10_flang-new/lib/libamath.so . |
| 94 | +
|
| 95 | +$ cd .. |
| 96 | +``` |
| 97 | + |
| 98 | +On the `.rpm`-based systems, the easiest way to obtain and extract `libamath.a` |
| 99 | +and `libamath.so` (current latest version, 24.10) is to do the following: |
| 100 | + |
| 101 | +``` |
| 102 | +$ mkdir libamath |
| 103 | +
|
| 104 | +$ cd libamath |
| 105 | +
|
| 106 | +$ wget https://developer.arm.com/-/cdn-downloads/permalink/Arm-Performance-Libraries/Version_24.10/arm-performance-libraries_24.10_rpm_flang-new.tar |
| 107 | +
|
| 108 | +$ tar -xf arm-performance-libraries_24.10_rpm_flang-new.tar |
| 109 | +
|
| 110 | +$ arm-performance-libraries_24.10_rpm/arm-performance-libraries_24.10_rpm.sh -a -f -s . |
| 111 | +
|
| 112 | +$ rpm2cpio armpl_24.10_flang-new.rpm | cpio -idmv |
| 113 | +
|
| 114 | +$ cp opt/arm/armpl_24.10_flang-new/lib/libamath.a . |
| 115 | +
|
| 116 | +$ cp opt/arm/armpl_24.10_flang-new/lib/libamath.so . |
| 117 | +
|
| 118 | +$ cd .. |
| 119 | +``` |
| 120 | + |
| 121 | +The directory to which `libamath.a` and `libamath.so` files have been copied |
| 122 | +must be pointed at by the `LIBRARIES_DIR` environmental variable. |
| 123 | + |
| 124 | +## Setting the environment variables in shell before running `build.sh` |
| 125 | + |
| 126 | +The `build.sh` script reads the following environment variables: |
| 127 | + |
| 128 | +- `README_MD_PATH` - Specifies the location of the README.md file to bundle |
| 129 | + (default: `arm-software/linux/README.md`) |
| 130 | +- `MKMODULEDIRS_PATH` - Specifies the location of mkmoduledirs.sh.var to tweak |
| 131 | + (default: `arm-software/linux/mkmoduledirs.sh.var`) |
| 132 | +- `SOURCES_DIR` - The directory where all source code will be stored |
| 133 | + (default: the top level of the cloned git repository) |
| 134 | +- `LIBRARIES_DIR` - The **optional** directory where the ArmPL veclibs will be stored |
| 135 | + (default: `arm-software/linux/lib`) |
| 136 | +- `PATCHES_DIR` - The **optional** directory where all patches will be stored |
| 137 | + (default: `arm-software/linux/patches`) |
| 138 | +- `BUILD_DIR` - The directory where all build will be happening |
| 139 | + (default: `arm-software/linux/build`) |
| 140 | +- `LOG_DIR` - The directory where all build logs will be stored |
| 141 | + (default: `arm-software/linux/logs`) |
| 142 | +- `OUTPUT_DIR` - The directory where all build output will be stored |
| 143 | + (default: `arm-software/linux/output`) |
| 144 | +- `RELEASE_FLAGS` - Enable release flags in the build `true`/`false` |
| 145 | + (default: false), set this to `true` when doing a proper release (not nightly) build |
| 146 | +- `PARALLEL_JOBS` - The number of parallel jobs to run during the build |
| 147 | + (default: number of the available CPU cores) |
| 148 | +- `ATFL_ASSERTIONS` - Enable assertions in the build ON/OFF |
| 149 | + (default: ON), set this to `OFF` when doing a proper release (not nightly) build |
| 150 | +- `TAR_NAME` - The name of the tarball to be created |
| 151 | + (default: atfl-0.0-linux-aarch64.tar.gz) |
| 152 | +- `ZLIB_STATIC_PATH` - Specifies the location of the static zlib library (libz.a) |
| 153 | + (default: `/usr/lib/aarch64-linux-gnu/libz.a`), on the RHEL and alike systems set this to `/usr/lib64/libz.a` |
| 154 | + |
| 155 | +Particular attention must be paid when doing a release build, the |
| 156 | +`RELEASE_FLAGS` and `ATFL_ASSERTIONS` variables must be set correctly. |
| 157 | + |
| 158 | +The optional directories (`PATCHES_DIR` and `LIBRARIES_DIR`) will not be used |
| 159 | +if not present. |
0 commit comments