1 This is Debian packaging of the Hercules compiler provided by ETHZ.
3 Compiling the compiler manually
4 ===============================
6 To compile the compiler, without creating the Debian package, run:
8 apt install quilt cmake ninja-build python3
10 git submodule update --init
11 export QUILT_PATCHES=debian/patches
12 export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
18 This will install the compiler and related stuff into
19 ~/opt/hercules-compiler.
21 Creating Debian packages
22 ========================
27 A simple method to create a native Debian package is the following:
29 apt install build-essential cmake ninja-build python3 gcc-5 g++-5
31 dpkg-buildpackage -b -uc
33 Note that gcc-5 may not be available in newer distributions such as
34 Debian Stretch. It is possible to compile it from source. For example
36 [Debian source package](http://ftp.debian.org/debian/pool/main/g/gcc-5/)
37 and build it with `DEB_BUILD_OPTIONS="nolang=ada,fortran,java,objc"
38 dpkg-buildpackage -b -uc -us`.
40 Sbuild method - native
41 ----------------------
43 You can also use the sbuild tool to create the native package. The
44 advantage is that the build happens in a clean environment, ensuring
45 that only distribution-provided packages are used for building.
47 Setup the sbuild chroot as documented at
48 [Debian Wiki](https://wiki.debian.org/sbuild) and then build the
57 Cross-compilation for different architecture is more complex,
58 especially in case of Ubuntu Xenial. Se let's start with simpler
59 variant - Debian Stretch.
61 ### Debian Stretch ###
63 For Debian Stretch, setup the chroot as above and install
64 qemu-user-static to both your host system and the build chroot:
66 sudo apt-get install qemu-user-static
67 sbuild-apt <chroot-name> apt-get install qemu-user-static
69 Then build the package with:
74 ### Ubuntu Xenial (TX2) ###
76 Setup the chroot as above. Ubuntu Xenial does not have
77 qemu-user-static package so copy the static binaries from your host:
79 sudo apt-get install qemu-user-static
80 cp /usr/bin/qemu-aarch64-static /path/to/your/chroot/xenaial/usr/bin
82 Then modify /etc/apt/sources.list to contain the URL of arm64 package
83 repository. This is the sources.list that I use:
85 deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial main universe multiverse restricted
86 deb-src http://cz.archive.ubuntu.com/ubuntu/ xenial main universe
88 deb [arch=arm64] http://ports.ubuntu.com/ xenial main universe multiverse restricted
90 Furthermore, Xenial has too old packages to cross build LLVM. For that
91 reason, we backport the following packages: `cmake_3.7.2-1` from
92 Debian Stretch and `ninja-build_1.8.2-1` from Debian unstable. Just
93 download the corresponding source packages (from e.g.
94 <https://packages.debian.org/source/stretch/cmake>) and run
96 sbuild -d xenial cmake_3.7.2-1.dsc
97 sbuild -d xenial ninja-build_1.8.2-1.dsc
99 Then install the created packages into the xenial chroot.
101 Then build the package by
104 sbuild --host=arm64 -d xenial --add-depends="libc6-dev, libstdc++-5-dev" --build-failed-commands='%s'
106 The `--build-failed-commands` switch ensures that a shell is run if
107 the build fails to allow investigating the problem.