This is Debian packaging of the Hercules compiler provided by ETHZ. Compiling the compiler manually =============================== To compile the compiler, without creating the Debian package, run: apt install quilt cmake ninja-build python3 git submodule update --init export QUILT_PATCHES=debian/patches export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index" quilt push -a make make install This will install the compiler and related stuff into ~/opt/hercules-compiler. Creating Debian packages ======================== Simple method ------------- A simple method to create a native Debian package is the following: apt install build-essential cmake ninja-build python3 make create-orig-tgz dpkg-buildpackage -uc -us Sbuild method - native ---------------------- You can also use the sbuild tool to create the native package. The advantage is that the build happens in a clean environment, ensuring that only distribution-provided packages are used for building. Setup the sbuild chroot as documented at https://wiki.debian.org/sbuild and then build the package with: make create-orig-tgz sbuild Sbuild method - cross --------------------- Cross-compilation for different architecture is more complex, especially in case of Ubuntu Xenial. Se let's start with simpler variant - Debian Stretch. ### Debian Stretch ### For Debian Stretch, setup the chroot as above and install qemu-user-static to both your host system and the build chroot: sudo apt-get install qemu-user-static sbuild-apt apt-get install qemu-user-static Then build the package with: make create-orig-tgz sbuild --host=arm64 ### Ubuntu Xenial (TX2) ### Setup the chroot as above. Ubuntu Xenial does not have qemu-user-static package so copy the static binaries from your host: sudo apt-get install qemu-user-static cp /usr/bin/qemu-aarch64-static /path/to/your/chroot/xenaial/usr/bin Then modify /etc/apt/sources.list to contain the URL of arm64 package repository. This is the sources.list that I use: deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial main universe deb-src http://cz.archive.ubuntu.com/ubuntu/ xenial main universe deb [arch=arm64] http://ports.ubuntu.com/ xenial main universe Furthermore, Xenial has too old packages to cross build LLVM. For that reason, we backport the following packages: `cmake_3.7.2-1` from Debian Stretch and `ninja-build_1.8.2-1` from Debian unstable. Just download the corresponding source packages (from e.g. https://packages.debian.org/source/stretch/cmake) and run sbuild -d xenial cmake_3.7.2-1.dsc sbuild -d xenial ninja-build_1.8.2-1.dsc Then install the created packages into the xenial chroot. Then build the package by make create-orig-tgz sbuild --host=arm64 -d xenial --add-depends="libc6-dev, libstdc++-5-dev" --build-failed-commands='%s' The `--build-failed-commands` switch ensures that a shell is run if the build fails to allow investigating the problem.