]> rtime.felk.cvut.cz Git - hercules2020/hercules-compiler.git/blob - README
Update to the new compiler version published by ETHZ
[hercules2020/hercules-compiler.git] / README
1 This is Debian packaging of the Hercules compiler provided by ETHZ.
2
3 Compiling the compiler manually
4 ===============================
5
6 To compile the compiler, without creating the Debian package, run:
7
8     apt install quilt cmake ninja-build python3
9
10     git submodule update --init
11     export QUILT_PATCHES=debian/patches
12     export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
13     quilt push -a
14
15     make
16     make install
17
18 This will install the compiler and related stuff into
19 ~/opt/hercules-compiler.
20
21 Creating Debian packages
22 ========================
23
24 Simple method
25 -------------
26
27 A simple method to create a native Debian package is the following:
28
29     apt install build-essential cmake ninja-build python3
30     make create-orig-tgz
31     dpkg-buildpackage -uc -us
32
33 Sbuild method - native
34 ----------------------
35
36 You can also use the sbuild tool to create the native package. The
37 advantage is that the build happens in a clean environment, ensuring
38 that only distribution-provided packages are used for building.
39
40 Setup the sbuild chroot as documented at
41 https://wiki.debian.org/sbuild and then build the package with:
42
43     make create-orig-tgz
44     sbuild
45
46 Sbuild method - cross
47 ---------------------
48
49 Cross-compilation for different architecture is more complex,
50 especially in case of Ubuntu Xenial. Se let's start with simpler
51 variant - Debian Stretch.
52
53 ### Debian Stretch ###
54
55 For Debian Stretch, setup the chroot as above and install
56 qemu-user-static to both your host system and the build chroot:
57
58     sudo apt-get install qemu-user-static
59     sbuild-apt <chroot-name> apt-get install qemu-user-static
60
61 Then build the package with:
62
63     make create-orig-tgz
64     sbuild --host=arm64
65
66 ### Ubuntu Xenial (TX2) ###
67
68 Setup the chroot as above. Ubuntu Xenial does not have
69 qemu-user-static package so copy the static binaries from your host:
70
71     sudo apt-get install qemu-user-static
72         cp /usr/bin/qemu-aarch64-static /path/to/your/chroot/xenaial/usr/bin
73
74 Then modify /etc/apt/sources.list to contain the URL of arm64 package
75 repository. This is the sources.list that I use:
76
77     deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial main universe
78     deb-src http://cz.archive.ubuntu.com/ubuntu/ xenial main universe
79
80     deb [arch=arm64] http://ports.ubuntu.com/ xenial main universe
81
82 Furthermore, Xenial has too old packages to cross build LLVM. For that
83 reason, we backport the following packages: `cmake_3.7.2-1` from
84 Debian Stretch and `ninja-build_1.8.2-1` from Debian unstable. Just
85 download the corresponding source packages (from e.g.
86 https://packages.debian.org/source/stretch/cmake) and run
87
88     sbuild -d xenial cmake_3.7.2-1.dsc
89         sbuild -d xenial ninja-build_1.8.2-1.dsc
90
91 Then install the created packages into the xenial chroot.
92
93 Then build the package by
94
95     make create-orig-tgz
96         sbuild --host=arm64 -d xenial --add-depends="libc6-dev, libstdc++-5-dev" --build-failed-commands='%s'
97
98 The `--build-failed-commands` switch ensures that a shell is run if
99 the build fails to allow investigating the problem.