-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME_build_llvm_clang
38 lines (34 loc) · 1.56 KB
/
README_build_llvm_clang
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
This README describes how to prepare armv7 clang and llvm for am572 TI sdk,
that allows to build samples/bpf from kernel tree directly on the target board.
1) Fetch sources from:
$ git clone https://github.com/llvm/llvm-project.git
2) Build llvm and clang for native system first (I'm using distcc), but
make sure the system has enouph RAM to link it (~25 GB)
$ mkdir build
$ cd build
$ CC="distcc gcc" CXX="distcc g++" cmake -DLLVM_ENABLE_PROJECTS=clang ../llvm
$ make -j16
3) Build llvm and clang for ARM, pointing llvm-tblgen and clang-tblgen from
build directory and --sysroot on ti sdk sysroot.
$ mkdir build_arm
$ cd build_arm
$ CC="distcc arm-linux-gnueabihf-gcc" CXX="distcc arm-linux-gnueabihf-g++" cmake \
--target=arm-linux-gnueabihf \
--sysroot=/home/ivan/emb/am572xx/ti-processor-sdk-linux-am57xx-evm-05.01.00.11/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi \
-DCMAKE_CROSSCOMPILING=True \
-DLLVM_TABLEGEN="/home/ivan/emb/llvm-project/build/bin/llvm-tblgen" \
-DCLANG_TABLEGEN="/home/ivan/emb/llvm-project/build/bin/clang-tblgen" \
-DLLVM_DEFAULT_TARGET_TRIPLE="arm-linux-gnueabihf" \
-DLLVM_TARGET_ARCH=ARM \
-DLLVM_ENABLE_PROJECTS=clang \
-G "Unix Makefiles" \
-DLLVM_TARGETS_TO_BUILD="BPF;ARM" \
-DCMAKE_INSTALL_PREFIX="/home/ivan/emb/llvm-project/install_dir" \
-DLLVM_ENABLE_PIC=False \
-DCMAKE_CXX_FLAGS='-march=armv7-a -mtune=cortex-a15 -mfloat-abi=hard' \
-DCMAKE_C_FLAGS='-march=armv7-a -mtune=cortex-a15 -mfloat-abi=hard' \
../llvm
$ make -j16
4) Copy needed binaries from build_arm on target board
4a) Or whole install_dir on target board after:
$make install