]> rtime.felk.cvut.cz Git - hercules2020/hercules-compiler.git/commitdiff
README: Cover cross-building for Xenial
authorMichal Sojka <michal.sojka@cvut.cz>
Thu, 10 May 2018 23:00:34 +0000 (01:00 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Fri, 11 May 2018 05:08:47 +0000 (07:08 +0200)
Makefile
README

index 938764d22b76dc42b90c6783ba534790e38e83a3..e340f0208966d3ae27454d038ef608972f92880f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -100,3 +100,6 @@ create-orig-tgz:
        git submodule foreach 'git archive --format=tar --prefix=$(prefix)/$$path/ -o $$toplevel/../$(prefix)-$$path.tar HEAD'
        $(tar_concat)
        gzip -c ../$(prefix).tar > "../$(prefix)_$(shell dpkg-parsechangelog --show-field Version|sed -e s/-.*//).orig.tar.gz"
+
+cross-tx2:
+       sbuild --host=arm64 -d xenial --add-depends="libc6-dev, libstdc++-5-dev" --build-failed-commands='%s'
diff --git a/README b/README
index b9d2a6b750e86fff8458a502e3eed6ef05913de9..363bd095d3d643a45839fce10bcfbd6ac9dcfe7c 100644 (file)
--- a/README
+++ b/README
@@ -21,26 +21,79 @@ This will install the compiler and related stuff into
 Creating Debian packages
 ========================
 
-A simple method to create the debian package is the following:
+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
 
-To create the package for different distribution and/or architecture
-sbuild is recommended. Setup the sbuild chroot as documented at
-https://wiki.debian.org/sbuild. Then run:
+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
 
-To cross-build the package for different architecture, first install
+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 <chroot-name> apt-get install qemu-user-static
 
-Then build the package:
+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.