Skip to content

Commit eadf9c9

Browse files
committed
[ATfL] Add HOWTO guide for the build.sh script
1 parent 094e614 commit eadf9c9

File tree

1 file changed

+158
-0
lines changed

1 file changed

+158
-0
lines changed

arm-software/linux/build.sh-HOWTO.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
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+
62+
#### Additionally, on more recent `.rpm`-based systems:
63+
64+
- `python3`
65+
- `python3-pip`
66+
- `python3-myst-parser` (since RHEL10)
67+
68+
## Optional: obtaining libamath.a and libamath.so
69+
70+
The Amath library is used by the loop vectorizer to vectorize the loops from
71+
which math functions are being called. This library is distributed along with
72+
Arm Performance Libraries.
73+
74+
On the `.deb`-based systems, the easiest way to obtain and extract `libamath.a`
75+
and `libamath.so` (current latest version, 24.10) is to do the following:
76+
77+
```
78+
$ mkdir libamath
79+
80+
$ cd libamath
81+
82+
$ wget https://developer.arm.com/-/cdn-downloads/permalink/Arm-Performance-Libraries/Version_24.10/arm-performance-libraries_24.10_deb_flang-new.tar
83+
84+
$ tar -xf arm-performance-libraries_24.10_deb_flang-new.tar
85+
86+
$ arm-performance-libraries_24.10_deb/arm-performance-libraries_24.10_deb.sh -a -f -s .
87+
88+
$ dpkg -x armpl_24.10_flang-new.deb .
89+
90+
$ cp opt/arm/armpl_24.10_flang-new/lib/libamath.a .
91+
92+
$ cp opt/arm/armpl_24.10_flang-new/lib/libamath.so .
93+
94+
$ cd ..
95+
```
96+
97+
On the `.rpm`-based systems, the easiest way to obtain and extract `libamath.a`
98+
and `libamath.so` (current latest version, 24.10) is to do the following:
99+
100+
```
101+
$ mkdir libamath
102+
103+
$ cd libamath
104+
105+
$ wget https://developer.arm.com/-/cdn-downloads/permalink/Arm-Performance-Libraries/Version_24.10/arm-performance-libraries_24.10_rpm_flang-new.tar
106+
107+
$ tar -xf arm-performance-libraries_24.10_rpm_flang-new.tar
108+
109+
$ arm-performance-libraries_24.10_rpm/arm-performance-libraries_24.10_rpm.sh -a -f -s .
110+
111+
$ rpm2cpio armpl_24.10_flang-new.rpm | cpio -idmv
112+
113+
$ cp opt/arm/armpl_24.10_flang-new/lib/libamath.a .
114+
115+
$ cp opt/arm/armpl_24.10_flang-new/lib/libamath.so .
116+
117+
$ cd ..
118+
```
119+
120+
The directory to which `libamath.a` and `libamath.so` files have been copied
121+
must be pointed at by the `LIBRARIES_DIR` environmental variable.
122+
123+
## Setting the environment variables in shell before running `build.sh`
124+
125+
The `build.sh` script reads the following environment variables:
126+
127+
- `README_MD_PATH` - Specifies the location of the README.md file to bundle
128+
(default: `arm-software/linux/README.md`)
129+
- `MKMODULEDIRS_PATH` - Specifies the location of mkmoduledirs.sh.var to tweak
130+
(default: `arm-software/linux/mkmoduledirs.sh.var`)
131+
- `SOURCES_DIR` - The directory where all source code will be stored
132+
(default: the top level of the cloned git repository)
133+
- `LIBRARIES_DIR` - The **optional** directory where the ArmPL veclibs will be stored
134+
(default: `arm-software/linux/lib`)
135+
- `PATCHES_DIR` - The **optional** directory where all patches will be stored
136+
(default: `arm-software/linux/patches`)
137+
- `BUILD_DIR` - The directory where all build will be happening
138+
(default: `arm-software/linux/build`)
139+
- `LOG_DIR` - The directory where all build logs will be stored
140+
(default: `arm-software/linux/logs`)
141+
- `OUTPUT_DIR` - The directory where all build output will be stored
142+
(default: `arm-software/linux/output`)
143+
- `RELEASE_FLAGS` - Enable release flags in the build `true`/`false`
144+
(default: false), set this to `true` when doing a proper release (not nightly) build
145+
- `PARALLEL_JOBS` - The number of parallel jobs to run during the build
146+
(default: number of the available CPU cores)
147+
- `ATFL_ASSERTIONS` - Enable assertions in the build ON/OFF
148+
(default: ON), set this to `OFF` when doing a proper release (not nightly) build
149+
- `TAR_NAME` - The name of the tarball to be created
150+
(default: atfl-0.0-linux-aarch64.tar.gz)
151+
- `ZLIB_STATIC_PATH` - Specifies the location of the static zlib library (libz.a)
152+
(default: `/usr/lib/aarch64-linux-gnu/libz.a`), on the RHEL and alike systems set this to `/usr/lib64/libz.a`
153+
154+
Particular attention must be paid when doing a release build, the
155+
`RELEASE_FLAGS` and `ATFL_ASSERTIONS` variables must be set correctly.
156+
157+
The optional directories (`PATCHES_DIR` and `LIBRARIES_DIR`) will not be used
158+
if not present.

0 commit comments

Comments
 (0)